public static CDogTools GetInstance() { if (null == mDogTools) { mDogTools = new CDogTools(); mDogTools.GetSerial(); } return(mDogTools); }
private void timer1_Tick(object sender, EventArgs e) { // return; timer1.Interval = 1000 * 60 * 1; try { // timer1.Enabled = false; if (timer1.Interval < 1000) { timer1.Interval = 1000 * 60 * 1; int re = CDogTools.GetInstance().GetUserAuthority(); if (re == -1) { CServers.GetServers().CloseService(); MessageBox.Show("您的加密狗已经在其他程序中使用,不能重复登录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else if (re <= 0) { CServers.GetServers().CloseService(); MessageBox.Show("未检测到加密狗!请确认是否已经插好!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } } else { if (!CDimTools.GetInstance().IsOut) { CServers.GetServers().GetUserName(); } else { MessageBox.Show("服务器异常,请确认网络或者加密狗", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } } } catch { MessageBox.Show("服务器异常,请确认网络或者加密狗", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } }
/// <summary> /// 验证当前该模块是否可用; /// </summary> /// <param name="mrModuleType"></param> /// <returns></returns> private bool ValidateModule(MrModuleType mrModuleType) { //需要验证加密狗; if (CCommonPara.mBEnableLock) { bool IsOut; if (!CDogTools.GetInstance().Validate(mrModuleType, out IsOut)) { if (IsOut) { return(false); } } return(true); } else { return(true); } }
private void timer1_Tick(object sender, EventArgs e) { if (!CCommonPara.mBEnableLock) { this.DialogResult = DialogResult.Yes; this.Close(); return; } try { timer1.Enabled = false; int re = CDogTools.GetInstance().GetUserAuthority(); if (re == -1) { MessageBox.Show("您的加密狗已经在其他程序中使用,不能重复登录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); CServers.GetServers().CloseService(); this.DialogResult = DialogResult.Cancel; this.Close(); return; } else if (re <= 0) { MessageBox.Show("未检测到加密狗!请确认是否已经插好!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); CServers.GetServers().CloseService(); this.DialogResult = DialogResult.Cancel; this.Close(); return; } } catch { MessageBox.Show("服务器异常,请确认网络或者加密狗", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.DialogResult = DialogResult.Cancel; this.Close(); return; } this.DialogResult = DialogResult.Yes; this.Close(); }