添加工艺程序页面
This commit is contained in:
commit
d7b8d4a3cf
5 files changed
+243
-2
No files matched your search
+1
-1
@@ -97,7 +97,7 @@
|
|||||||
<TextBlock Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Machine}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ListViewItem>
|
</ListViewItem>
|
||||||
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_MouseLeftButtonUp">
|
<ListViewItem Height="60" MouseLeftButtonUp="ListViewItem_Programgroup">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<materialDesign:PackIcon Kind="Database" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
<materialDesign:PackIcon Kind="Database" Width="25" Height="25" Margin="10" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text="{x:Static lang:Resources.Programgroup}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
<TextBlock Text="{x:Static lang:Resources.Programgroup}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
|
||||||
|
|||||||
+4
-1
@@ -90,7 +90,10 @@ namespace SunlightCentralizedControlManagement_SCCM_
|
|||||||
{
|
{
|
||||||
Picture.Content = new View.CurveView();
|
Picture.Content = new View.CurveView();
|
||||||
}
|
}
|
||||||
|
private void ListViewItem_Programgroup(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Picture.Content = new View.ProgramgroupView();
|
||||||
|
}
|
||||||
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
WindowsView.Help help_page = new WindowsView.Help();
|
WindowsView.Help help_page = new WindowsView.Help();
|
||||||
|
|||||||
@@ -110,6 +110,9 @@
|
|||||||
<Compile Include="View\MonitorView.xaml.cs">
|
<Compile Include="View\MonitorView.xaml.cs">
|
||||||
<DependentUpon>MonitorView.xaml</DependentUpon>
|
<DependentUpon>MonitorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="View\ProgramgroupView.xaml.cs">
|
||||||
|
<DependentUpon>ProgramgroupView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="View\RoilingTextBlock.xaml.cs">
|
<Compile Include="View\RoilingTextBlock.xaml.cs">
|
||||||
<DependentUpon>RoilingTextBlock.xaml</DependentUpon>
|
<DependentUpon>RoilingTextBlock.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -153,6 +156,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="View\ProgramgroupView.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="View\RoilingTextBlock.xaml">
|
<Page Include="View\RoilingTextBlock.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.ProgramgroupView"
|
||||||
|
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:SunlightCentralizedControlManagement_SCCM_.View"
|
||||||
|
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="630" d:DesignWidth="1280">
|
||||||
|
<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" Click="ProgramgroupView_edit_Click"/>
|
||||||
|
<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" Click="ProgramgroupView_new_Click"/>
|
||||||
|
<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=90}" 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="ProcessID" Binding="{Binding ProgramID}" Width="0" MinWidth="0" MaxWidth="0"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.ProcessName}" Width="400" Binding="{Binding ProgramName}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Step}" Width="90" Binding="{Binding Step}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Time}" Width="100" Binding="{Binding Time}" IsReadOnly="True"/>
|
||||||
|
<DataGridTextColumn Header="{x:Static lang:Resources.Remark}" Width="*" Binding="{Binding Notes}" IsReadOnly="True"/>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<ContentControl x:Name="container"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
|
|
||||||
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ProgramgroupView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ProgramgroupView : UserControl
|
||||||
|
{
|
||||||
|
public ProgramgroupView()
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProgramgroupView_edit_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
/*if (Programgroup_ID == null) return;
|
||||||
|
|
||||||
|
container.Content = new ProgramstepsView();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProgramgroupView_new_Click(object sender, RoutedEventArgs e)//新建按钮
|
||||||
|
{
|
||||||
|
/* InputBox frm = new InputBox();
|
||||||
|
frm.Accept += new EventHandler(InputBox_new_accept);
|
||||||
|
frm.ShowDialog();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputBox_new_accept(object sender, EventArgs e)//新建按钮窗口返回
|
||||||
|
{
|
||||||
|
//事件的接收者通过一个简单的类型转换得到InputBox的引用
|
||||||
|
/* InputBox frm = (InputBox)sender;
|
||||||
|
//接收到InputBox的TextBox值
|
||||||
|
string VALUE = frm.InputValue;
|
||||||
|
|
||||||
|
string ID = (StrToInt.To16Convert10( DateTime.Now.ToString("yy"))+ StrToInt.To16Convert10(DateTime.Now.ToString("MM"))+StrToInt.To16Convert10(DateTime.Now.ToString("dd"))).ToString()+
|
||||||
|
DateTime.Now.ToString("HH")+DateTime.Now.ToString("mm")+DateTime.Now.ToString("ss"); //id为时间合
|
||||||
|
|
||||||
|
Dictionary<string, object> Program_new = new Dictionary<string, object>();//缓存函数
|
||||||
|
Program_new.Add("ProgramName", VALUE);
|
||||||
|
Program_new.Add("ProgramID", ID);
|
||||||
|
Program_new.Add("Step", "0");
|
||||||
|
Program_new.Add("Time", "0:00");
|
||||||
|
Program_new.Add("Notes", null);
|
||||||
|
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
SQLiteHelpers.InsertData("ProgramName", Program_new);// 执行插入
|
||||||
|
SQLiteHelpers.Close(); //关闭连接
|
||||||
|
|
||||||
|
Programgroup_Numder = VALUE;
|
||||||
|
Programgroup_ID = ID;
|
||||||
|
|
||||||
|
Programgroup_sql();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProgramgroupView_del_Click(object sender, RoutedEventArgs e)//删除
|
||||||
|
{
|
||||||
|
/* if(Programgroup_Numder == null)return;
|
||||||
|
///弹窗提示确认删除
|
||||||
|
if (System.Windows.Forms.MessageBox.Show(Properties.Resources.Confirm + Properties.Resources.Delete + Programgroup_Numder, "Delete ",
|
||||||
|
System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
///执行删除
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
SQLiteHelpers.Delete("ProgramName", "ProgramID='" + Programgroup_ID + "'", null);
|
||||||
|
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();*/
|
||||||
|
}
|
||||||
|
void InputBox_Rename_accept(object sender, EventArgs e)//重命名按钮窗口返回
|
||||||
|
{
|
||||||
|
//事件的接收者通过一个简单的类型转换得到InputBox的引用
|
||||||
|
/* InputBox frm = (InputBox)sender;
|
||||||
|
//接收到InputBox的TextBox值
|
||||||
|
string VALUE = frm.InputValue;
|
||||||
|
Dictionary<string, object> Program_Rename = new Dictionary<string, object>();//缓存函数
|
||||||
|
Program_Rename.Add("ProgramName", VALUE);
|
||||||
|
|
||||||
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||||
|
SQLiteHelpers.Open(); //打开数据库
|
||||||
|
SQLiteHelpers.Update("ProgramName", Program_Rename, "ProgramID='"+ Programgroup_ID + "'",null);
|
||||||
|
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();*/
|
||||||
|
}
|
||||||
|
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;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Programgroup_Numder { get; set; }
|
||||||
|
public static string Programgroup_ID { get; set; }
|
||||||
|
|
||||||
|
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列,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user