sc 12 months ago
parent
commit
388afd4fea
  1. 9
      Properties/Resources.Designer.cs
  2. 3
      Properties/Resources.en-US.resx
  3. 3
      Properties/Resources.resx
  4. 3
      Properties/Resources.zh-CN.resx
  5. 9
      Properties/Resources.zh-TW.resx
  6. 7
      SunlightCentralizedControlManagement_SCCM_.csproj
  7. 65
      View/ProgramgroupView.xaml
  8. 128
      View/ProgramgroupView.xaml.cs
  9. 19
      WindowsView/InputBox.xaml
  10. 65
      WindowsView/InputBox.xaml.cs

9
Properties/Resources.Designer.cs

@ -825,6 +825,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Group 的本地化字符串。
/// </summary>
public static string Group {
get {
return ResourceManager.GetString("Group", resourceCulture);
}
}
/// <summary>
/// 查找类似 GuidingWheel 的本地化字符串。
/// </summary>

3
Properties/Resources.en-US.resx

@ -912,4 +912,7 @@
<data name="Search" xml:space="preserve">
<value>Search</value>
</data>
<data name="Group" xml:space="preserve">
<value>Group</value>
</data>
</root>

3
Properties/Resources.resx

@ -912,4 +912,7 @@
<data name="Search" xml:space="preserve">
<value>Search</value>
</data>
<data name="Group" xml:space="preserve">
<value>Group</value>
</data>
</root>

3
Properties/Resources.zh-CN.resx

@ -912,4 +912,7 @@
<data name="Search" xml:space="preserve">
<value>搜索</value>
</data>
<data name="Group" xml:space="preserve">
<value>组</value>
</data>
</root>

9
Properties/Resources.zh-TW.resx

@ -906,4 +906,13 @@
<data name="Enddate" xml:space="preserve">
<value>結束日期</value>
</data>
<data name="SelectDate" xml:space="preserve">
<value>選擇日期</value>
</data>
<data name="Search" xml:space="preserve">
<value>搜尋</value>
</data>
<data name="Group" xml:space="preserve">
<value>組</value>
</data>
</root>

7
SunlightCentralizedControlManagement_SCCM_.csproj

@ -122,6 +122,9 @@
<Compile Include="WindowsView\Help.xaml.cs">
<DependentUpon>Help.xaml</DependentUpon>
</Compile>
<Compile Include="WindowsView\InputBox.xaml.cs">
<DependentUpon>InputBox.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -172,6 +175,10 @@
<SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator>
</Page>
<Page Include="WindowsView\InputBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">

65
View/ProgramgroupView.xaml

@ -4,24 +4,23 @@
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"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
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.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 x:Name="Grid" AlternationCount="2" IsReadOnly="True" PreviewMouseLeftButtonUp="Grid_PreviewMouseLeftButtonUp" MouseDoubleClick="Grid_MouseDoubleClick" 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" Margin="0,0,0,60">
<DataGrid.RowStyle >
<Style TargetType="{x:Type DataGridRow}">
<Setter Property="Height" Value="30" />
@ -54,11 +53,55 @@
<!--列信息绑定-->
<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.Group}" Width="90" Binding="{Binding Group}" 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"/>
<StackPanel x:Name="scr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal" Margin="0,0,0,0">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_New" x:Name="Resume">
<StackPanel Orientation="Horizontal" >
<materialDesign:PackIcon Kind="NewBox" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.New}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_edit" IsEnabled="False" x:Name="edit">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Edit" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.edit}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Rename" IsEnabled="False" x:Name="Rename">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Rename" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Rename}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Remark" IsEnabled="False" x:Name="Remark">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Note" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Remark}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Delete" IsEnabled="False" x:Name="Delete">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Delete}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel>
</ListViewItem>
</ListView>
</StackPanel>
</Grid>
</UserControl>

128
View/ProgramgroupView.xaml.cs

@ -1,4 +1,5 @@
using System;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows;
@ -19,7 +20,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
DataSet sql; //内存数据缓存
public void Programgroup_sql()
@ -53,8 +54,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
frm.ShowDialog();*/
}
void InputBox_new_accept(object sender, EventArgs e)//新建按钮窗口返回
{
// void InputBox_new_accept(object sender, EventArgs e)//新建按钮窗口返回
// {
//事件的接收者通过一个简单的类型转换得到InputBox的引用
/* InputBox frm = (InputBox)sender;
//接收到InputBox的TextBox值
@ -79,25 +80,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
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)//重命名按钮
{
@ -154,7 +139,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
public static string Programgroup_Numder { get; set; }
public static string Programgroup_ID { get; set; }
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)//表格选择事件
private void Grid_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)//表格选择事件
{
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
@ -162,6 +147,103 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
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列,
}
edit.IsEnabled = true;
Rename.IsEnabled = true;
Remark.IsEnabled = true;
Delete.IsEnabled = true;
}
private void Grid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)//双击表格编辑事件
{
}
private void ListViewItem_New(object sender, System.Windows.Input.MouseButtonEventArgs 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 = DateTime.Now.ToString("yyMMddHHmmss"); //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 ListViewItem_edit(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
edit.IsEnabled = false;
Rename.IsEnabled = false;
Remark.IsEnabled = false;
Delete.IsEnabled = false;
}
private void ListViewItem_Rename(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
edit.IsEnabled = false;
Rename.IsEnabled = false;
Remark.IsEnabled = false;
Delete.IsEnabled = false;
}
private void ListViewItem_Remark(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
edit.IsEnabled = false;
Rename.IsEnabled = false;
Remark.IsEnabled = false;
Delete.IsEnabled = false;
}
private void ListViewItem_Delete(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
edit.IsEnabled = false;
Rename.IsEnabled = false;
Remark.IsEnabled = false;
Delete.IsEnabled = false;
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;
}
}
}

19
WindowsView/InputBox.xaml

@ -0,0 +1,19 @@
<Window x:Class="SunlightCentralizedControlManagement_SCCM_.WindowsView.InputBox"
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:SunlightCentralizedControlManagement_SCCM_.WindowsView"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
ResizeMode ="NoResize"
Title="SUNLIGHT"
Height="150" Width="400">
<Grid FocusManager.FocusedElement="{Binding ElementName=Boxx}">
<TextBox x:Name="Boxx" Height="40" Margin="20,10,20,0" VerticalAlignment="Top" FontSize="26"
MaxLines="1" BorderThickness="3,3,3,3" ClipToBounds="True"/>
<Button Content="{x:Static lang:Resources.YES}" HorizontalAlignment="Left" Height="35" Margin="50,70,0,5" VerticalAlignment="Bottom" Width="80" Click="YES_Click"/>
<Button Content="{x:Static lang:Resources.NO}" HorizontalAlignment="Right" Height="35" Margin="0,70,50,5" VerticalAlignment="Bottom" Width="80" Click="NO_Click"/>
</Grid>
</Window>

65
WindowsView/InputBox.xaml.cs

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
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.Imaging;
using System.Windows.Shapes;
namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
{
/// <summary>
/// InputBox.xaml 的交互逻辑
/// </summary>
public partial class InputBox : Window
{
public InputBox()
{
InitializeComponent();
this.DataContext = this;
FocusManager.SetFocusedElement(Boxx, Boxx);
}
public string InputValue
{
get
{
return Boxx.Text;
}
set
{
this.Boxx.Text = value;
}
}
public event EventHandler Accept;
private void YES_Click(object sender, RoutedEventArgs e)
{
var input = Boxx.Text.TrimStart(); //去除字符串前空格
if (input.Length == 0) //字长度不等于0有效
{
Boxx.Focus(); //聚焦元素
}
else
{
if (Accept != null)
{
Accept(this, EventArgs.Empty);
}
this.Close(); //关闭窗口
}
}
private void NO_Click(object sender, RoutedEventArgs e)
{
this.Close(); //关闭窗口
}
}
}
Loading…
Cancel
Save