染色机计算机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

117 lines
4.8 KiB

using DyeingComputer.View;
using System;
using System.Collections.Generic;
using System.Data;
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
{
/// <summary>
/// ViewStep.xaml 的交互逻辑
/// </summary>
public partial class ViewStep : Window
{
public string data { get; set; }
public ViewStep()
{
InitializeComponent();
Form1_Load();
FocusManager.SetFocusedElement(boxNAME, boxNAME);
}
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 readonly string[] a = {"001","007","008","013","017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050",
"051", "054", "055", "056","064","065","066","067","090","091","093","094" };
private void Form1_Load()
{
this.boxID.Items.Add(Properties.Resources.TemperatureControl);//温度控制001
this.boxID.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.WaterLevel + ")");//水位进水007
this.boxID.Items.Add(Properties.Resources.AddWater + "(" + Properties.Resources.Flowmeter + ")");//流量进水008
this.boxID.Items.Add(Properties.Resources.Washing + "(" + Properties.Resources.WaterLevel + ")");//水位水洗013
this.boxID.Items.Add(Properties.Resources.Washing + "(" + Properties.Resources.Cooling + ")");//降温水洗017
this.boxID.Items.Add(Properties.Resources.Drainage);//排水020
this.boxID.Items.Add(Properties.Resources.PumpDrainage);//主泵排水022
this.boxID.Items.Add(Properties.Resources.RunningTime);//运转031
this.boxID.Items.Add(Properties.Resources.ClothIntake);//入布035
this.boxID.Items.Add(Properties.Resources.OutTheCloth);//出布036
this.boxID.Items.Add(Properties.Resources.CallWorkers);//呼叫操作员039
this.boxID.Items.Add(Properties.Resources.Sampling);//取样040
this.boxID.Items.Add(Properties.Resources.End);//程序结束041
this.boxID.Items.Add(Properties.Resources.Await);//等待049
this.boxID.Items.Add(Properties.Resources.Pressurized);//加压050
this.boxID.Items.Add(Properties.Resources.Depressurized);//减压051
this.boxID.Items.Add(Properties.Resources.PumpSpeed);//泵速度054
this.boxID.Items.Add(Properties.Resources.PumpStart);//泵启动055
this.boxID.Items.Add(Properties.Resources.PumpStops);//泵停止056
this.boxID.Items.Add(Properties.Resources.PrepareMedications);//备药064
this.boxID.Items.Add(Properties.Resources.AddTheMedicine);//加药065
this.boxID.Items.Add(Properties.Resources.CallDistribution);//呼叫输送066
this.boxID.Items.Add(Properties.Resources.CallPreparation);//呼叫准备067
this.boxID.Items.Add(Properties.Resources.RapidAcidAddition);//快速加酸090
this.boxID.Items.Add(Properties.Resources.PHTemperatureControl);//ph温度控制091
this.boxID.Items.Add(Properties.Resources.PHDetection);//ph检测093
this.boxID.Items.Add(Properties.Resources.PHControl);//ph控制094
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)//输入事件
{
int l = boxNAME.Text.Length;
string text = boxNAME.Text.ToString();
if (l == 3)
{
int g = Array.IndexOf(a, text);//数组索引
if (g != -1)
{
boxID.SelectedIndex = g;//有效索引传入
} else
{
boxID.SelectedIndex =-1;
// boxNAME.Text = Properties.Resources.Invalidfeatures;//功能无效
}
}
}
private void BoxID_SelectionChanged(object sender, SelectionChangedEventArgs e)//下拉框选择事件
{
if (boxID.SelectedIndex !=-1)
{
int i = boxID.SelectedIndex;
boxNAME.Text = a.ElementAt(i);
}
}
private void YES_Click(object sender, RoutedEventArgs e)
{
}
private void NO_Click(object sender, RoutedEventArgs e)
{
this.Close(); //关闭窗口
}
}
}