sc 1 year ago
parent
commit
40aacd3a65
  1. 8
      DyeingComputer.csproj
  2. 1
      MainWindow.xaml
  3. 2
      View/ProgramgroupView.xaml.cs
  4. 16
      View/ProgramstepsView .xaml.cs
  5. 2
      Windows/InputBox.xaml
  6. 21
      Windows/ViewStep.xaml
  7. 127
      Windows/ViewStep.xaml.cs

8
DyeingComputer.csproj

@ -134,6 +134,9 @@
<Compile Include="Windows\InputBox.xaml.cs"> <Compile Include="Windows\InputBox.xaml.cs">
<DependentUpon>InputBox.xaml</DependentUpon> <DependentUpon>InputBox.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Windows\ViewStep.xaml.cs">
<DependentUpon>ViewStep.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -194,6 +197,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="Windows\ViewStep.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -270,6 +277,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Model\" /> <Folder Include="Model\" />
<Folder Include="ViewWorkstep\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommonServiceLocator"> <PackageReference Include="CommonServiceLocator">

1
MainWindow.xaml

@ -10,7 +10,6 @@
Title="SUNLIGHT 838 b0.0.1 (2024/08/10)" Title="SUNLIGHT 838 b0.0.1 (2024/08/10)"
Height="720" Width="1280"> Height="720" Width="1280">
<!--WindowState ="Maximized" WindowStyle="None"--> <!--WindowState ="Maximized" WindowStyle="None"-->
<Window.Resources> <Window.Resources>
<Style x:Key="RadioButtonStyle" TargetType="{x:Type RadioButton}"> <Style x:Key="RadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}"/> <Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}"/>

2
View/ProgramgroupView.xaml.cs

@ -119,7 +119,6 @@ namespace DyeingComputer.View
frm.Accept += new EventHandler(InputBox_Rename_accept); frm.Accept += new EventHandler(InputBox_Rename_accept);
frm.ShowDialog(); frm.ShowDialog();
} }
void InputBox_Rename_accept(object sender, EventArgs e)//重命名按钮窗口返回 void InputBox_Rename_accept(object sender, EventArgs e)//重命名按钮窗口返回
{ {
//事件的接收者通过一个简单的类型转换得到InputBox的引用 //事件的接收者通过一个简单的类型转换得到InputBox的引用
@ -146,7 +145,6 @@ namespace DyeingComputer.View
frm.Accept += new EventHandler(InputBox_Remark_accept); frm.Accept += new EventHandler(InputBox_Remark_accept);
frm.ShowDialog(); frm.ShowDialog();
} }
void InputBox_Remark_accept(object sender, EventArgs e)//备注按钮窗口返回 void InputBox_Remark_accept(object sender, EventArgs e)//备注按钮窗口返回
{ {
//事件的接收者通过一个简单的类型转换得到InputBox的引用 //事件的接收者通过一个简单的类型转换得到InputBox的引用

16
View/ProgramstepsView .xaml.cs

@ -95,14 +95,17 @@ namespace DyeingComputer.View
} }
} }
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)// private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)//编辑
{ {
ViewStep viewstop = new ViewStep();
viewstop.ShowDialog();
} }
private void ProgramgroupView_Quit_Click(object sender, RoutedEventArgs e)//退出 private void ProgramgroupView_Quit_Click(object sender, RoutedEventArgs e)//退出
{ {
this.Visibility = Visibility.Collapsed;//隐藏控件 this.Visibility = Visibility.Collapsed;//隐藏控件
} }
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除行 private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除行
{ {
int d = 0; int d = 0;
@ -117,6 +120,7 @@ namespace DyeingComputer.View
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
} }
} }
private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入行 private void ProgramgroupView_Insert_Click(object sender, RoutedEventArgs e)//插入行
{ {
int d = 0; int d = 0;
@ -131,6 +135,7 @@ namespace DyeingComputer.View
Dat(); Dat();
Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表 Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
} }
private void ProgramgroupView_Save_Click(object sender, RoutedEventArgs e)//保存 private void ProgramgroupView_Save_Click(object sender, RoutedEventArgs e)//保存
{ {
int r = 0; int r = 0;
@ -154,6 +159,11 @@ namespace DyeingComputer.View
r = SQLiteHelpers.InsertData("ProgramSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入 r = SQLiteHelpers.InsertData("ProgramSteps", SQLiteHelpers.DataTableToDictionary(data_t));//行插入
} }
Dictionary<string, object> Program_Step = new Dictionary<string, object>();//缓存函数
Program_Step.Add("Step", a-1);
SQLiteHelpers.Update("ProgramName", Program_Step, "ProgramID='" + ProgramID + "'", null);
SQLiteHelpers.Close(); //关闭连接 SQLiteHelpers.Close(); //关闭连接
if (r != 0) if (r != 0)
{ {
@ -161,8 +171,6 @@ namespace DyeingComputer.View
this.Visibility = Visibility.Collapsed;//隐藏控件 this.Visibility = Visibility.Collapsed;//隐藏控件
} }
} }
} }
} }

2
Windows/InputBox.xaml

@ -7,7 +7,7 @@
mc:Ignorable="d" mc:Ignorable="d"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
ResizeMode ="NoResize" ResizeMode ="NoResize"
Title="SUNLIGHT 838" Title="SUNLIGHT 800"
Height="150" Width="400"> Height="150" Width="400">
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}"> <Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26" <TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"

21
Windows/ViewStep.xaml

@ -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>

127
Windows/ViewStep.xaml.cs

@ -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…
Cancel
Save