diff --git a/MainWindow.xaml b/MainWindow.xaml
index 65ed723..44886a5 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -68,7 +68,7 @@
-
+
@@ -115,9 +115,15 @@
-
+
+
+
+
+
+
+
+
-
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 0d6060c..1cf29e1 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -3,6 +3,7 @@ using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -15,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Threading;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
namespace SunlightCentralizedControlManagement_SCCM_
@@ -28,7 +30,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
{
DataContext = new MainWindowViewModel();
InitializeComponent();
-
+ CountDown();
+ CDkey_();
}
private void ButtonPopUpLogout_Click(object sender, RoutedEventArgs e)
@@ -99,14 +102,15 @@ namespace SunlightCentralizedControlManagement_SCCM_
Picture.Content = new View.ProgramgroupView();
}
private void ListViewItem_ConveyorCenters(object sender, MouseButtonEventArgs e)
- {
-
+ {
+ WindowsView.User user_ =new WindowsView.User();
+ user_.Show();
}
private void Buttonhelp_Click(object sender, RoutedEventArgs e)
{
WindowsView.Help help_page = new WindowsView.Help();
- help_page.Show();
+ help_page.Show();
}
private void ButtonSYS_Click(object sender, RoutedEventArgs e)
{
@@ -118,5 +122,76 @@ namespace SunlightCentralizedControlManagement_SCCM_
WindowsView.CDKEY cDKEY = new WindowsView.CDKEY();
cDKEY.Show();
}
+
+ public void CountDown()
+ {
+ DispatcherTimer timer1s = new DispatcherTimer//初始化循环
+ {
+ Interval = TimeSpan.FromHours(1)
+ };
+ timer1s.Tick += Tick_Event_1H;
+ timer1s.Start();
+ }
+ void Tick_Event_1H(object sender, EventArgs e)//Tick_Event周期执行事件
+ {
+ CDkey_();
+ }
+
+ private static UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
+ private void CDkey_()
+ {
+ try
+ {
+ string id_1 = MainWindowViewModel.SN_ID.Substring(5, 1) + MainWindowViewModel.SN_ID.Substring(0, 1) +
+ MainWindowViewModel.SN_ID.Substring(4, 1) + MainWindowViewModel.SN_ID.Substring(1, 1) +
+ MainWindowViewModel.SN_ID.Substring(3, 1) + MainWindowViewModel.SN_ID.Substring(2, 1);
+ if ((id_1 == MainWindowViewModel.SN_KEY.Substring(0, 6)) && (MainWindowViewModel.SN_KEY.Length == 16))
+ {
+ if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(MainWindowViewModel.SN_KEY.Substring(0, 12)), true) == MainWindowViewModel.SN_KEY.Substring(12, 4)) //校验key的crc校验值
+ {
+ string Y = (2255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(6, 2))).ToString();
+ string M = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(8, 2))).ToString();
+ string D = (255 - StrToInt.To16Convert10(MainWindowViewModel.SN_KEY.Substring(10, 2))).ToString();
+
+ string YY = DateTime.Now.ToString("yyyy");
+ string MM = DateTime.Now.ToString("MM");
+ string DD = DateTime.Now.ToString("dd");
+
+ keytext.Text = "注册到期时间: " + Y + "/" + M + "/" + D;
+
+ if (string.Compare(Y, YY) < 0)
+ {
+ if (string.Compare(M, MM) < 0)
+ {
+ if (string.Compare(D, DD) < 0)
+ {
+ Configini.IniWritevalue("SN", " SN1", "0000000000000000");
+ Cdk_page.Visibility = Visibility.Visible; //cdk_pageT_T = -1; //防止触发倒计时
+ }
+ else if ((int.Parse(D) - int.Parse(DD)) <= 10)//提前10天提醒
+ {
+ Cdk_page.Visibility = Visibility.Visible;
+ }
+ }
+ }
+ }
+ else
+ {
+ Cdk_page.Visibility = Visibility.Visible;
+ keytext.Text = "许可证安全校验错误请重新激活";
+ }
+ }
+ else
+ {
+ Cdk_page.Visibility = Visibility.Visible;
+ keytext.Text = "计算机信息变更当前许可证失效";
+ }
+ }
+ catch (Exception)
+ {
+ keytext.Text = "许可证安全校验错误请重新激活";
+ }
+ }
+
}
}
diff --git a/SunlightCentralizedControlManagement_SCCM_.csproj b/SunlightCentralizedControlManagement_SCCM_.csproj
index 69cbcc5..9a3c8a1 100644
--- a/SunlightCentralizedControlManagement_SCCM_.csproj
+++ b/SunlightCentralizedControlManagement_SCCM_.csproj
@@ -187,6 +187,9 @@
SchedulingTime.xaml
+
+ User.xaml
+
ViewStep.xaml
@@ -292,6 +295,10 @@
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs
index 5767934..fd36bd6 100644
--- a/ViewModel/MainWindowViewModel.cs
+++ b/ViewModel/MainWindowViewModel.cs
@@ -59,12 +59,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static string SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
public static string SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
public static string SQLPASWORD = Configini.IniReadvalue("SQL_SERVER", "SQL5");
+ public static string SN_ID = Configini.IniReadvalue("SN", "SN2");
+ public static string SN_KEY = Configini.IniReadvalue("SN", "SN1");
public static SqlConnection conn_SC =new SqlConnection();//数据库
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
public static DataTable Machines = new DataTable(); //设备表缓存
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
public static int ERR_c = 0;//错误计数器
+
public MainWindowViewModel()
{
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
diff --git a/WindowsView/User.xaml b/WindowsView/User.xaml
new file mode 100644
index 0000000..32246b7
--- /dev/null
+++ b/WindowsView/User.xaml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WindowsView/User.xaml.cs b/WindowsView/User.xaml.cs
new file mode 100644
index 0000000..c230873
--- /dev/null
+++ b/WindowsView/User.xaml.cs
@@ -0,0 +1,85 @@
+using SunlightCentralizedControlManagement_SCCM_.View;
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.Text.RegularExpressions;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
+{
+ ///
+ /// Machine.xaml 的交互逻辑
+ ///
+ public partial class User : Window
+ {
+
+ CheckBox[] checkBoxes = new CheckBox[99];
+ string[] strings = new string[0] { };
+ public User()
+ {
+ WindowStartupLocation = WindowStartupLocation.CenterScreen;
+ InitializeComponent();
+ }
+
+ private async void user_Loaded(object sender, RoutedEventArgs e)//打开页面执行
+ {
+ for (int i = 0; i < strings.Length; i++)
+ {
+ checkBoxes[i] = new CheckBox();
+ checkBoxes[i].Content = strings[i].ToString();
+ checkBoxes[i].FontSize = 20;
+ checkBoxes[i].Width = 80;
+ checkBoxes[i].Height = 50;
+ checkBoxes[i].IsEnabled = false;
+ Capacity.Children.Add(checkBoxes[i]);
+ }
+ }
+
+
+
+ private void Tb_KeyFloating(object sender, TextCompositionEventArgs e)//输入事件
+ {
+ //Regex re = new Regex("[^0-9.-]+");
+ Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
+ e.Handled = !re.IsMatch(e.Text);
+ }
+ string Capacity_;
+ private void DataGridMac_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件
+ {
+ int rownum = DataGriduser.SelectedIndex;//获取鼠标选中行并定义变量
+ if (rownum != -1)//判断鼠标定位是否有效
+ {
+ /*定位选中行及指定列单元格文本信息*/
+ _Name.Text = (DataGriduser.Columns[0].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();//定位第列
+ GROUP.Text = (DataGriduser.Columns[1].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
+ Capacity_ = (DataGriduser.Columns[2].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
+ Note.Text = (DataGriduser.Columns[3].GetCellContent(DataGriduser.Items[rownum]) as TextBlock).Text.Trim();
+ }
+
+ Pasword.Text = null; //清除密码框
+ }
+
+ private async void Button_Preservation(object sender, RoutedEventArgs e)//保存按钮事件
+ {
+ Regex re_number = new Regex(@"^[0-9]+(.[0-9]{1,2})?$");//校验用正则表达式有1~2位小数的正实数
+ Regex re_char = new Regex(@"^[A-Za-z0-9\s@()()/+!!_-]+$");//校验用正则表达式由数字,26个英文字母,空白字符和@()()/+!!_-组成的字符串
+
+ string name = _Name.Text;
+ string password = Pasword.Text;
+ string Group = GROUP.Text;
+ int Cap = 0;
+ string note = Note.Text;
+ string Stuff_sql;
+
+
+
+ }
+
+ private async void Button_Delete(object sender, RoutedEventArgs e)//删除按钮事件
+ {
+
+ }
+ }
+}