Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2363 → Rev 2364

/MKLiveView/v1.0/Source/KeyPad/Keypad.xaml
175,14 → 175,17
<Button x:Name="button17" Background="WhiteSmoke"
Command="{Binding PressAndRelease}" CommandParameter="NUMPAD0" Click="button_Click" Content="0" />
</Grid>
<Grid Grid.Column="2" Grid.Row="4">
<Grid x:Name="gDecimal" Grid.Column="2" Grid.Row="4">
<Border Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="4" />
<Button x:Name="button19" Background="WhiteSmoke"
Command="{Binding PressAndRelease}" CommandParameter="DECIMAL" Click="button_Click" Content="." />
Command="{Binding PressAndRelease}" CommandParameter="DECIMAL" Click="button_Click" Content="," />
</Grid>
<Grid Grid.ColumnSpan="3">
<Border Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="0" />
<Label Content="{Binding Result}" HorizontalContentAlignment="Right" Background="WhiteSmoke" Margin="4"/>
<Border Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="0" >
<!--<TextBox x:Name="textBox" HorizontalAlignment="Left" Height="49" Text="{Binding Result}" VerticalAlignment="Top" Width="212" AllowDrop="False" IsUndoEnabled="False" IsReadOnly="True"/>-->
</Border>
<Label Content="{Binding Result}" HorizontalContentAlignment="Right" Background="WhiteSmoke" Margin="4"/>
 
</Grid>
<Grid Grid.Column="3" >
<Border Style="{StaticResource buttonBorder}" Background="Black" CornerRadius="4" />
/MKLiveView/v1.0/Source/KeyPad/Keypad.xaml.cs
31,15 → 31,35
/// </summary>
public partial class Keypad : Window,INotifyPropertyChanged
{
#region Public Properties
 
private string _result;
int length = 0;
double min = 0, max = 0;
#region Public Properties
public double MIN
{
get { return min; }
set { min = value; }
}
public double MAX
{
get { return max; }
set { max = value; }
}
public int LENGTH
{
get { return length; }
set { length = value; }
}
public string Result
{
get { return _result; }
set { _result = value; this.OnPropertyChanged("Result"); }
}
 
public void disableDecimal()
{
gDecimal.Visibility = Visibility.Hidden;
}
#endregion
public Keypad(Window owner)
59,7 → 79,10
break;
 
case "RETURN":
this.DialogResult = true;
double result1;
if (Double.TryParse(Result, out result1))
if (result1 <= max && result1 >= min && Result.Length <= length)
this.DialogResult = true;
break;
 
case "BACK":
68,7 → 91,14
break;
 
default:
Result += button.Content.ToString();
string tmp = Result + button.Content.ToString();
double result;
// if (Double.TryParse(tmp,System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.CreateSpecificCulture("en-GB"),out result))
if (Double.TryParse(tmp,out result))
{
if (result <= max && tmp.Length <= length)
Result += button.Content.ToString();
}
break;
}
}