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.Shapes; namespace DyeingComputer.Windows { /// /// TouchKeyboard.xaml 的交互逻辑 /// public partial class TouchKeyboardNumeral : Window { private bool isShiftActive = false; private bool isSymbolActive = false; public string KeyValue; public TouchKeyboardNumeral() { InitializeComponent(); } private void KeyButton_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; if (button != null) { string key = button.Content.ToString(); if (key.Length == 1 && char.IsLetter(key[0])) { key = isShiftActive ? key.ToUpper() : key.ToLower(); } PreviewTextBox.Text += key; } } private void Backspace_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(PreviewTextBox.Text)) { PreviewTextBox.Text = PreviewTextBox.Text.Substring(0, PreviewTextBox.Text.Length - 1); } } private void Enter_Click(object sender, RoutedEventArgs e) { KeyValue = PreviewTextBox.Text; this.Close(); // PreviewTextBox.Text += Environment.NewLine; } private void Hide_Click(object sender, RoutedEventArgs e) { this.Close(); } } }