|
- using System;
- using System.Collections.Generic;
- 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.Navigation;
- using System.Windows.Shapes;
-
- namespace BPASmartClient.CustomResource.UserControls
- {
- /// <summary>
- /// NumberTextBox.xaml 的交互逻辑
- /// </summary>
- public partial class NumberTextBox : UserControl
- {
- public NumberTextBox()
- {
- InitializeComponent();
- }
-
-
- private void outLoc_GotFocus(object sender, RoutedEventArgs e)
- {
- this.pp.IsOpen = outLoc.Focusable;
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- var obj = (Button)sender;
- switch (obj.Content)
- {
- case "0":
- case "1":
- case "2":
- case "3":
- case "4":
- case "5":
- case "6":
- case "7":
- case "8":
- case "9":
- input.Text = input.Text.Trim() + obj.Content.ToString();
- break;
- case ".":
- if (!string.IsNullOrEmpty(input.Text) && input.Text.Length > 0)
- input.Text = input.Text.Trim() + obj.Content.ToString();
- break;
- case "ESC":
- this.pp.IsOpen = false;
- break;
- case "BR":
- if (!string.IsNullOrEmpty(input.Text) && input.Text.Length > 0)
- input.Text = input.Text.Remove(input.Text.Length - 1);
- break;
- case "Clear":
- input.Text = string.Empty;
- break;
- case "Deter":
- outLoc.Text = input.Text;
- this.pp.IsOpen = false;
- break;
- default:
- break;
- }
- }
-
- private void input_GotFocus(object sender, RoutedEventArgs e)
- {
-
- }
-
-
- }
- }
|