using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; 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 { /// /// ViewStep.xaml 的交互逻辑 /// public partial class ViewStep : Window { public ViewStep() { InitializeComponent(); } private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件 { //Regex re = new Regex("[^0-9.-]+"); Regex re = new Regex(@"^[0-9]+(.[0-9]{1,3})?$");// 非零的正整数 e.Handled = !re.IsMatch(e.Text); } private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { int l = code.Text.Length; string text = code.Text.ToString(); if (l == 3) { if(text == "001") { } else if (text == "007") { } else if (text == "008") { } else if (text == "013") { } else if (text == "014") { } else if (text == "017") { } else if (text == "020") { } else if (text == "022") { } else if (text == "031") { } else if (text == "035") { } else if (text == "036") { } else if (text == "039") { } else if (text == "040") { } else if (text == "041") { } else if (text == "049") { } else if (text == "050") { } else if (text == "051") { } else if (text == "054") { } else if (text == "055") { } else if (text == "056") { } else if (text == "065") { } else if (text == "066") { } else if (text == "067") { } else if (text == "072") { } else if (text == "073") { } else if (text == "074") { } else if (text == "075") { } else if (text == "076") { } else if (text == "077") { } else if (text == "070") { } else if (text == "090") { } else if (text == "091") { } else if (text == "092") { } else if (text == "093") { } else if (text == "094") { } else if (text == "095") { } else if (text == "096") { } else if (text == "097") { } else if (text == "101") { } else if (text == "102") { } else if (text == "103") { } } } } }