private void pbLogin_Click(object sender, EventArgs e) { if (pnContainer.Controls.Count == 0) { form.Show(); applicationIdle.Stop(); applicationIdle.Dispose(); manage = null;//单例资源释放 this.Dispose(); } else { switch (dm.FormClosing(sender, e)) { case DialogResult.OK: if (DialogResult.Yes == Utils.ShowMessageBox(Messages.LogOut, Messages.TitleWarning, MessageBoxButtons.YesNo)) { SignOut(); } break; case DialogResult.Cancel: break; default: SignOut(); break; } } }
static void Main() { if (_componentVersion != SoftwareVersion.VersionForAuthentication || _componentVersion != Common.Versions) { return; } Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); //Application.Run(new TrialValidation()); Process instance = RunningInstance(); if (instance == null) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (_componentVersion != SoftwareVersions.S) { Application.Run(new Login()); } else { Application.Run(DeviceManage.GetInstance(new Login())); } //Application.Run(new UserWizard()); } else { HandleRunningInstance(instance); } }
/*单例*/ public static DeviceManage GetInstance(Form form) { if (manage == null) { manage = new DeviceManage(form); } return(manage); }
private void ShowMainForm() { this.Hide(); DeviceManage dm = DeviceManage.GetInstance(this); if (dm != null && !dm.IsDisposed) { dm.WindowState = FormWindowState.Maximized; dm.Show(); } }
private void Logout() { if (form != null) { lock (form) { form.Invoke(new Action(delegate() { form.Show(); applicationIdle.Stop(); applicationIdle.Dispose(); manage = null; this.Dispose(); })); } } }
private void btnLogin_Click(object sender, EventArgs e) { if (loginUI.Login()) { //this.tbAccount.Focus(); //this.tbAccount.Clear(); this.tbPwd.Clear(); this.lbAccount.Text = ""; this.lbPwd.Text = ""; this.Visible = false; DeviceManage dm = DeviceManage.GetInstance(this); if (dm != null && !dm.IsDisposed) { dm.Show(); } } }
/// <summary> /// 自动登出检查 /// </summary> private void UserSessionChecker() { UserSession.BeginTimer(60000, delegate(object sender, EventArgs args) { if (!UserSession.SessionAlive) { UserSession.MinutesAlive += (int)UserSession.UserTimer.Interval / 60000; if (UserSession.MinutesAlive >= Common.Policy.InactivityTime) { form.Invoke(new Action(delegate() { form.Show(); manage = null; this.Dispose(); })); } } else { UserSession.MinutesAlive = 0; } UserSession.ResetTimer(); }); //UserSession.Begin(); }
private void btnLogIn_Click(object sender, EventArgs e) { form.Show(); manage = null;//单例资源释放 this.Dispose(); }