using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace B3DealerClient.Control
|
|
{
|
|
/// <summary>
|
|
/// NumberPad.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class NumberPad : Window, INotifyPropertyChanged
|
|
{
|
|
#region Public Properties
|
|
|
|
private string _result = string.Empty;
|
|
public string Result
|
|
{
|
|
get { return _result; }
|
|
private set
|
|
{
|
|
if (_result != value)
|
|
{
|
|
_result = value;
|
|
this.OnPropertyChanged("Result");
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public NumberPad(Window owner)
|
|
{
|
|
InitializeComponent();
|
|
this.Owner = owner;
|
|
lbl.DataContext = this;
|
|
}
|
|
|
|
private void button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
Button button = sender as Button;
|
|
switch (button.CommandParameter.ToString())
|
|
{
|
|
case "ESC":
|
|
this.Close();
|
|
break;
|
|
|
|
case "RETURN":
|
|
this.DialogResult = true;
|
|
break;
|
|
|
|
case "BACK":
|
|
if (Result.Length > 0)
|
|
Result = Result.Remove(Result.Length - 1);
|
|
break;
|
|
|
|
default:
|
|
Result += button.Content.ToString();
|
|
break;
|
|
}
|
|
}
|
|
|
|
#region INotifyPropertyChanged members
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
private void OnPropertyChanged(String info)
|
|
{
|
|
if (PropertyChanged != null)
|
|
{
|
|
PropertyChanged(this, new PropertyChangedEventArgs(info));
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|