sc 1 year ago
parent
commit
7e3d1f6a7e
  1. 7
      DyeingComputer.csproj
  2. 27
      Properties/Resources.Designer.cs
  3. 9
      Properties/Resources.en-US.resx
  4. 9
      Properties/Resources.resx
  5. 9
      Properties/Resources.zh-CN.resx
  6. 9
      Properties/Resources.zh-TW.resx
  7. 5
      View/ProgramgroupView.xaml
  8. 40
      View/ProgramgroupView.xaml.cs
  9. 66
      View/ProgramstepsView .xaml
  10. 69
      View/ProgramstepsView .xaml.cs
  11. 4
      View/WorkOrderView.xaml.cs

7
DyeingComputer.csproj

@ -115,6 +115,9 @@
<Compile Include="View\ParameterSetView.xaml.cs">
<DependentUpon>ParameterSetView.xaml</DependentUpon>
</Compile>
<Compile Include="View\ProgramstepsView .xaml.cs">
<DependentUpon>ProgramstepsView .xaml</DependentUpon>
</Compile>
<Compile Include="View\ProgramgroupView.xaml.cs">
<DependentUpon>ProgramgroupView.xaml</DependentUpon>
</Compile>
@ -166,6 +169,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\ProgramstepsView .xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\ProgramgroupView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

27
Properties/Resources.Designer.cs

@ -96,6 +96,15 @@ namespace DyeingComputer.Properties {
}
}
/// <summary>
/// 查找类似 Code 的本地化字符串。
/// </summary>
public static string Code {
get {
return ResourceManager.GetString("Code", resourceCulture);
}
}
/// <summary>
/// 查找类似 Confirm 的本地化字符串。
/// </summary>
@ -123,6 +132,15 @@ namespace DyeingComputer.Properties {
}
}
/// <summary>
/// 查找类似 Directives 的本地化字符串。
/// </summary>
public static string Directives {
get {
return ResourceManager.GetString("Directives", resourceCulture);
}
}
/// <summary>
/// 查找类似 edit 的本地化字符串。
/// </summary>
@ -177,6 +195,15 @@ namespace DyeingComputer.Properties {
}
}
/// <summary>
/// 查找类似 ID 的本地化字符串。
/// </summary>
public static string ID {
get {
return ResourceManager.GetString("ID", resourceCulture);
}
}
/// <summary>
/// 查找类似 I/O 的本地化字符串。
/// </summary>

9
Properties/Resources.en-US.resx

@ -228,4 +228,13 @@
<data name="Rename" xml:space="preserve">
<value>Rename</value>
</data>
<data name="ID" xml:space="preserve">
<value>ID</value>
</data>
<data name="Directives" xml:space="preserve">
<value>Directives</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
</root>

9
Properties/Resources.resx

@ -228,4 +228,13 @@
<data name="Step" xml:space="preserve">
<value>Step</value>
</data>
<data name="Code" xml:space="preserve">
<value>Code</value>
</data>
<data name="Directives" xml:space="preserve">
<value>Directives</value>
</data>
<data name="ID" xml:space="preserve">
<value>ID</value>
</data>
</root>

9
Properties/Resources.zh-CN.resx

@ -228,4 +228,13 @@
<data name="Rename" xml:space="preserve">
<value>重命名</value>
</data>
<data name="ID" xml:space="preserve">
<value>ID</value>
</data>
<data name="Directives" xml:space="preserve">
<value>指令</value>
</data>
<data name="Code" xml:space="preserve">
<value>代码</value>
</data>
</root>

9
Properties/Resources.zh-TW.resx

@ -228,4 +228,13 @@
<data name="Rename" xml:space="preserve">
<value>重新命名</value>
</data>
<data name="ID" xml:space="preserve">
<value>ID</value>
</data>
<data name="Directives" xml:space="preserve">
<value>指令</value>
</data>
<data name="Code" xml:space="preserve">
<value>代碼</value>
</data>
</root>

5
View/ProgramgroupView.xaml

@ -14,8 +14,7 @@
<Button Content="{x:Static lang:Resources.Delete}" x:Name="ProgramgroupView_del" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="800,0,0,0" VerticalAlignment="Top" Width="200" Background="White" Click="ProgramgroupView_del_Click"/>
<Button Content="{x:Static lang:Resources.Rename}" x:Name="ProgramgroupView_Rename" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="400,0,0,0" VerticalAlignment="Top" Width="200" Background="White" Click="ProgramgroupView_Rename_Click"/>
<Button Content="{x:Static lang:Resources.Remark}" x:Name="ProgramgroupView_Remark" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="600,0,0,0" VerticalAlignment="Top" Width="200" Background="White" Click="ProgramgroupView_Remark_Click"/>
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
Margin="0,40,0,0" d:ItemsSource="{d:SampleData ItemCount=20}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
@ -62,6 +61,6 @@
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Width="*" Binding="{Binding Notes}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
<ContentControl x:Name="container"/>
</Grid>
</UserControl>

40
View/ProgramgroupView.xaml.cs

@ -50,14 +50,15 @@ namespace DyeingComputer.View
SQLiteHelpers.Close(); //关闭连接
Programgroup_Numder = null;
Programgroup_ID = null;
//sql.Clear(); //清除缓存
//System.GC.Collect();
}
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)
{
if (Programgroup_ID == null) return;
container.Content = new ProgramstepsView();
}
@ -90,6 +91,8 @@ namespace DyeingComputer.View
SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
SQLiteHelpers.Close(); //关闭连接
Programgroup_ID = ID;
Programgroup_sql();
}
@ -106,10 +109,13 @@ namespace DyeingComputer.View
SQLiteHelpers.Close();
Programgroup_sql();
}
Programgroup_Numder = null;
Programgroup_ID = null;
}
private void ProgramgroupView_Rename_Click(object sender, RoutedEventArgs e)//重命名按钮
{
if (Programgroup_ID == null) return;
InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Rename_accept);
frm.ShowDialog();
@ -130,15 +136,39 @@ namespace DyeingComputer.View
SQLiteHelpers.Close(); //关闭连接
Programgroup_sql();
Programgroup_Numder = null;
Programgroup_ID = null;
}
private void ProgramgroupView_Remark_Click(object sender, RoutedEventArgs e)//备注
{
if (Programgroup_ID == null) return;
InputBox frm = new InputBox();
frm.Accept += new EventHandler(InputBox_Remark_accept);
frm.ShowDialog();
}
private void ProgramgroupView_Remark_Click(object sender, RoutedEventArgs e)
void InputBox_Remark_accept(object sender, EventArgs e)//备注按钮窗口返回
{
//事件的接收者通过一个简单的类型转换得到InputBox的引用
InputBox frm = (InputBox)sender;
//接收到InputBox的TextBox值
string VALUE = frm.InputValue;
Dictionary<string, object> Program_Remark = new Dictionary<string, object>();//缓存函数
Program_Remark.Add("Notes", VALUE);
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
SQLiteHelpers.Update("ProgramName", Program_Remark, "ProgramID='" + Programgroup_ID + "'", null);
SQLiteHelpers.Close(); //关闭连接
Programgroup_sql();
Programgroup_Numder = null;
Programgroup_ID = null;
}
string Programgroup_Numder;
string Programgroup_ID;
string Programgroup_Numder = null;
string Programgroup_ID = null;
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
{
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量

66
View/ProgramstepsView .xaml

@ -0,0 +1,66 @@
<UserControl x:Class="DyeingComputer.View.ProgramstepsView "
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:DyeingComputer.View"
xmlns:lang="clr-namespace:DyeingComputer.Properties"
mc:Ignorable="d"
d:DesignHeight="630" d:DesignWidth="1280" HorizontalAlignment="Left">
<Grid>
<Rectangle Margin="0,0,0,0" Fill="#FFCCCCCC" VerticalAlignment="Top" Height="40"/>
<Button Content="{x:Static lang:Resources.edit}" x:Name="ProgramgroupView_edit" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="200,0,0,0" VerticalAlignment="Top" Width="200" Background="White" />
<Button Content="{x:Static lang:Resources.New}" x:Name="ProgramgroupView_new" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="0,0,0,0" VerticalAlignment="Top" Width="200" Background="White" />
<Button Content="{x:Static lang:Resources.Delete}" x:Name="ProgramgroupView_del" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="800,0,0,0" VerticalAlignment="Top" Width="200" Background="White"/>
<Button Content="{x:Static lang:Resources.Rename}" x:Name="ProgramgroupView_Rename" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="400,0,0,0" VerticalAlignment="Top" Width="200" Background="White" />
<Button Content="{x:Static lang:Resources.Remark}" x:Name="ProgramgroupView_Remark" FontSize="20" HorizontalAlignment="Left" Height="40" Margin="600,0,0,0" VerticalAlignment="Top" Width="200" Background="White" />
<DataGrid x:Name="Grid" AlternationCount="2" IsReadOnly="True" SelectionChanged="Grid_SelectionChanged"
Margin="0,40,0,0" d:ItemsSource="{d:SampleData ItemCount=20}" AutoGenerateColumns="False" MinColumnWidth="30"
HorizontalGridLinesBrush="#FFC9C9C9" VerticalGridLinesBrush="#FFC9C9C9" GridLinesVisibility="All" BorderBrush="#CCCCCC"
BorderThickness="1,1,1,1" ColumnHeaderHeight="40" HorizontalContentAlignment="Right" Grid.ColumnSpan="2" AllowDrop="False"
CanUserReorderColumns="False" CanUserSortColumns="False" CanUserResizeRows="False" CanUserResizeColumns="False"
CanUserAddRows="False" CanUserDeleteRows="False" HeadersVisibility ="Column"
Background="White" SelectionMode="Single" FontSize="15">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
<Setter Property="FontSize" Value="25" />
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#FFFFFFFF" />
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#FFF0F0F0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False"/>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinWidth" Value="20"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#FFC0C0C0"/>
<Setter Property="BorderBrush" Value="#FFC0C0C0"/>
<Setter Property="Foreground" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<!--列信息绑定-->
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Width="60" Binding="{Binding ProgramName}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Code}" Width="100" Binding="{Binding Step}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Directives}" Width="200" Binding="{Binding Time}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.ParameterSet}" Width="*" Binding="{Binding Notes}" IsReadOnly="True"/>
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Width="*" Binding="{Binding Notes}" IsReadOnly="True"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
</UserControl>

69
View/ProgramstepsView .xaml.cs

@ -0,0 +1,69 @@
using DyeingComputer.UserClass;
using DyeingComputer.Windows;
using formula_manage.UserClass;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Net;
using System.Text;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static DyeingComputer.UserClass.SqliteHelper;
namespace DyeingComputer.View
{
/// <summary>
/// ProgramgroupView.xaml 的交互逻辑
/// </summary>
public partial class ProgramstepsView : UserControl
{
public ProgramstepsView()
{
InitializeComponent();
Programgroup_sql();
}
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
DataSet sql; //内存数据缓存
public void Programgroup_sql()
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
string sql_script = "select * from ProgramName order by ProgramID desc";
if (sql != null) sql.Clear(); //清空缓存
sql = SQLiteHelpers.ExecuteDataSet(sql_script, null); //读取计划表写入缓存
// if (sql != null) Grid.ItemsSource = sql.Tables[0].DefaultView; //转换显示计划表
SQLiteHelpers.Close(); //关闭连接
//sql.Clear(); //清除缓存
//System.GC.Collect();
}
string Programgroup_Numder = null;
string Programgroup_ID = null;
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
{
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
Programgroup_ID = (Grid.Columns[0].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
Programgroup_Numder = (Grid.Columns[1].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
}
}
}
}

4
View/WorkOrderView.xaml.cs

@ -87,6 +87,7 @@ namespace DyeingComputer.View
private void WorkOrderView_lock_Click(object sender, RoutedEventArgs e)//锁定按钮
{
if (WorkOrder_Numder == null) return;
Dictionary<string, object> lock_v = new Dictionary<string, object>();//缓存函数
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
SQLiteHelpers.Open(); //打开数据库
@ -107,11 +108,12 @@ namespace DyeingComputer.View
private void WorkOrderView_new_Click(object sender, RoutedEventArgs e)//新建按钮
{
WpfPlot();
}
private void WorkOrderView_del_Click(object sender, RoutedEventArgs e)//删除按钮
{
if (WorkOrder_Numder == null) return;
///弹窗提示确认删除
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + WorkOrder_Numder , "Delete ",
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)

Loading…
Cancel
Save