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(); Form1_Load(); } 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 Form1_Load() { this.boxID.Items.Add(Properties.Resources.TemperatureControl); this.boxID.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.WaterLevel + ")"); this.boxID.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.Flowmeter + ")"); this.boxID.Items.Add(Properties.Resources.Washing + "(" + Properties.Resources.WaterLevel + ")"); } private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { int l = boxNAME.Text.Length; string text = boxNAME.Text.ToString(); if (l == 3) { if(text == "001") { boxID.SelectedIndex = 0; //温度控制 } else if (text == "007") { boxID.SelectedIndex = 1; //水位入水 } else if (text == "008") { boxID.SelectedIndex = 2; //流量入水 } else if (text == "013") { boxID.SelectedIndex = 3;//水洗 } 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") { } } } private void boxID_SelectionChanged(object sender, SelectionChangedEventArgs e) { } } }