7 changed files with 169 additions and 8 deletions
@ -0,0 +1,21 @@ |
|||
<Window x:Class="DyeingComputer.Windows.ViewStep" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:local="clr-namespace:DyeingComputer.Windows" |
|||
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 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" |
|||
TextChanged="TextBox_TextChanged" PreviewTextInput="Tb_KeyPress" InputMethod.IsInputMethodEnabled="False" FontSize="20" HorizontalContentAlignment="Right"/> |
|||
<Grid Margin="5,100,5,5"> |
|||
<ContentControl x:Name="container"/> |
|||
</Grid> |
|||
</Grid> |
|||
</Window> |
@ -0,0 +1,127 @@ |
|||
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 |
|||
{ |
|||
/// <summary>
|
|||
/// ViewStep.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
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") { } |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue