This commit is contained in:
sc committed 2024-08-28 23:50:39 +08:00
commit b66a4a13e5
7 files changed
+137 -10

No files matched your search

+2 -2
View File
@@ -11,8 +11,8 @@
<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 HorizontalAlignment="Right" Height="30" Margin="0,60,10,0" VerticalAlignment="Top" Width="230" FontSize="20" />
<TextBox x:Name="box" HorizontalAlignment="Right" Height="30" Margin="0,20,10,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="230" MaxLines="1" ClipToBounds="True"
<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"/>
<Grid Margin="5,100,5,5">
<ContentControl x:Name="container"/>
+39 -8
View File
@@ -23,6 +23,7 @@ namespace DyeingComputer.Windows
public ViewStep()
{
InitializeComponent();
Form1_Load();
}
private void Tb_KeyPress(object sender, TextCompositionEventArgs e)//输入事件
@@ -31,23 +32,48 @@ namespace DyeingComputer.Windows
//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 = code.Text.Length;
string text = code.Text.ToString();
int l = boxNAME.Text.Length;
string text = boxNAME.Text.ToString();
if (l == 3)
{
if(text == "001") { }
if(text == "001")
{
boxID.SelectedIndex = 0; //温度控制
}
else
if (text == "007") { }
if (text == "007")
{
boxID.SelectedIndex = 1; //水位入水
}
else
if (text == "008") { }
if (text == "008")
{
boxID.SelectedIndex = 2; //流量入水
}
else
if (text == "013") { }
else
if (text == "014") { }
if (text == "013")
{
boxID.SelectedIndex = 3;//水洗
}
else
if (text == "017") { }
else
@@ -123,5 +149,10 @@ namespace DyeingComputer.Windows
}
}
private void boxID_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
}
}