CDKEY提示修改
This commit is contained in:
commit
59ba780070
3 files changed
+87
-14
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using formula_manage.SQLModels;
|
||||
using formula_manage.UserClass;
|
||||
using formula_manage.ViewModel;
|
||||
using formula_manage.Windows;
|
||||
using GalaSoft.MvvmLight;
|
||||
@@ -14,6 +15,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml.Linq;
|
||||
@@ -61,6 +63,42 @@ namespace formula_manage.ViewModel
|
||||
string TEXT_SQLUSER;
|
||||
string TEXT_SQLPASWOR;
|
||||
string Connstr_SC;
|
||||
string SN_ID;
|
||||
string SN_KEY;
|
||||
|
||||
private void CDkey_()
|
||||
{
|
||||
string id_1 = SN_ID.Substring(5, 1) + SN_ID.Substring(0, 1) + SN_ID.Substring(4, 1) + SN_ID.Substring(1, 1) + SN_ID.Substring(3, 1) + SN_ID.Substring(2, 1);
|
||||
if ((id_1 == SN_KEY.Substring(0, 6)) && (SN_KEY.Length == 16))
|
||||
{
|
||||
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(SN_KEY.Substring(0, 12)), true) == SN_KEY.Substring(12, 4)) //校验key的crc校验值
|
||||
{
|
||||
string Y = (2255 - StrToInt.To16Convert10(SN_KEY.Substring(6, 2))).ToString();
|
||||
string M = (255 - StrToInt.To16Convert10(SN_KEY.Substring(8, 2))).ToString();
|
||||
string D = (255 - StrToInt.To16Convert10(SN_KEY.Substring(10, 2))).ToString();
|
||||
|
||||
string YY = DateTime.Now.ToString("yyyy");
|
||||
string MM = DateTime.Now.ToString("MM");
|
||||
string DD = DateTime.Now.ToString("dd");
|
||||
|
||||
if (string.Compare(Y, YY) < 0)
|
||||
{
|
||||
CDKEY cDKEY = new CDKEY();
|
||||
cDKEY.ShowDialog();//实例化并置顶打开窗口
|
||||
}
|
||||
else if (string.Compare(M, MM) < 0)
|
||||
{
|
||||
CDKEY cDKEY = new CDKEY();
|
||||
cDKEY.ShowDialog();//实例化并置顶打开窗口
|
||||
}
|
||||
else if (string.Compare(D, DD) < 0)
|
||||
{
|
||||
CDKEY cDKEY = new CDKEY();
|
||||
cDKEY.ShowDialog();//实例化并置顶打开窗口
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async void Sql_()
|
||||
{
|
||||
@@ -70,6 +108,9 @@ namespace formula_manage.ViewModel
|
||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||
SN_ID = Configini.IniReadvalue("SN", "SN2");
|
||||
SN_KEY = Configini.IniReadvalue("SN", "SN1");
|
||||
|
||||
if (TEXT_SQMOD == "0") //判断连接方式
|
||||
{
|
||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||
@@ -173,22 +214,33 @@ namespace formula_manage.ViewModel
|
||||
/// </summary>
|
||||
public void CountDown()
|
||||
{
|
||||
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(0.5)
|
||||
Interval = TimeSpan.FromSeconds(1)
|
||||
};
|
||||
timer.Tick += Tick_Event;
|
||||
timer.Start();
|
||||
timer1s.Tick += Tick_Event_1S;
|
||||
timer1s.Start();
|
||||
|
||||
DispatcherTimer timer1h = new DispatcherTimer//初始化循环,每1h调用一次Tick
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(3600)
|
||||
};
|
||||
timer1h.Tick += Tick_Event_1h;
|
||||
timer1h.Start();
|
||||
//设置定时器
|
||||
// disTimer.Tick += new EventHandler(DisTimer_Tick);//每一秒执行的方法
|
||||
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||
// disTimer.Start();//计时开始
|
||||
}
|
||||
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
{
|
||||
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
void Tick_Event_1h(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
{
|
||||
CDkey_();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class Product //stuff_Product
|
||||
|
||||
Reference in new issue
Block a user