This commit is contained in:
sc committed 2024-08-29 23:54:59 +08:00
commit 318bbd1a78
7 files changed
+513 -22

No files matched your search

+5 -4
View File
@@ -4,16 +4,17 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DyeingComputer.Windows"
xmlns:lang="clr-namespace:DyeingComputer.Properties"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize"
Title="SUNLIGHT 800" Height="450" Width="400">
<Grid FocusManager.FocusedElement="{Binding ElementName=box}">
<TextBlock x:Name="code" HorizontalAlignment="Left" Height="30" Margin="10,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBlock x:Name="name" HorizontalAlignment="Left" Height="30" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="20" Text="12345125" SelectionChanged="boxID_SelectionChanged"/>
<TextBlock Text="{x:Static lang:Resources.Code}" HorizontalAlignment="Left" Height="30" Margin="10,20,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<TextBlock Text="{x:Static lang:Resources.Function}" HorizontalAlignment="Left" Height="30" Margin="10,60,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="150" FontSize="20" Background="#FFEFEEEE"/>
<ComboBox x:Name="boxID" HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="20" Text="12345125" SelectionChanged="BoxID_SelectionChanged"/>
<TextBox x:Name="boxNAME" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right"/>
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right" MaxLength="3"/>
<Grid Margin="5,100,5,5">
<ContentControl x:Name="container"/>
</Grid>
+46 -18
View File
@@ -34,37 +34,65 @@ namespace DyeingComputer.Windows
e.Handled = !re.IsMatch(e.Text);
}
string[] a = {"001","007","008","013","017", "020", "022", "031", "035", "036", "039", "040", "041", "049", "050",
"051", "054", "055", "056","065","066","067","090","091","092","093","094" };
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);
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 + ")");
this.boxID.Items.Add(Properties.Resources.Washing + "(" + Properties.Resources.Cooling + ")");
this.boxID.Items.Add(Properties.Resources.Drainage);
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)
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)//输入事件
{
int l = boxNAME.Text.Length;
string text = boxNAME.Text.ToString();
if (l == 3)
{
boxID.SelectedIndex = Array.IndexOf(a, text);
{
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)
private void BoxID_SelectionChanged(object sender, SelectionChangedEventArgs e)//下拉框选择事件
{
if (boxID.SelectedIndex !=-1)
{
int i = boxID.SelectedIndex;
boxNAME.Text = a.ElementAt(i);
}
}
}
}