/// <summary> /// 设置登录参数 /// </summary> public void SetLoginParameter(IMLibrary3.Protocol.Auth auth) { this.auth = auth; cmbBoxUserID.Text = auth.UserID; txtPassword.Text = auth.Password; ShowType1.State = auth.ShowType; checkBoxSavePassword.Checked = auth.IsSavePassword; checkBoxAutoLogin.Checked = auth.IsAutoLogin; }
private void controlPanel1_UserLoginSuccessful(object sender, IMLibrary3.Protocol.Auth auth) { this.showNotifyIconMessage("上次登录IP:" + (auth.LastIP == null ? "" : auth.LastIP) + " \n上次登录时间:" + (auth.LastDateTime == null ? "" : auth.LastDateTime), "OurMsg 登录成功", 5000); this.notifyIcon1.Text = "OurMsg:" + auth.UserName + "(" + auth.UserID + ")"; this.labUserName.Text = auth.UserName + "(" + auth.UserID + ")"; ShowType1.State = auth.ShowType; #region 除登录进度效果显示面板 this.Controls.Remove(this.userLoginPanel1); this.userLoginPanel1.Dispose(); #endregion IsLogined = true;//标识当前用户已经登录过系统 }
private void cmbBoxUserID_SelectedIndexChanged(object sender, EventArgs e) { IMLibrary3.Protocol.Auth a = cmbBoxUserID.SelectedItem as IMLibrary3.Protocol.Auth; if (a != null) { this.txtPassword.Text = a.Password; this.checkBoxAutoLogin.Checked = a.IsAutoLogin; this.checkBoxSavePassword.Checked = a.IsSavePassword; this.ShowType1.State = a.ShowType; this.auth.ShowType = a.ShowType; if (this.checkBoxSavePassword.Checked && this.checkBoxAutoLogin.Checked && !IsRepeat) { butLogin_Click(null, null);//自动登录 } } }
/// <summary> /// 准备登录 /// </summary> private void ReadyLogin(bool IsRepeat) { try { this.Hide(); if (frmLogin == null || frmLogin.IsDisposed) { frmLogin = new FormLogin(); } frmLogin.IsRepeat = IsRepeat; if (IsRepeat && this.auth != null)//如果是重复登录,则更改登录参数 { frmLogin.SetLoginParameter(this.auth); } frmLogin.ShowDialog(); if (frmLogin.isExit) //如果退出应用程序 { this.ExitApp(); //退出应用程序 } else//如果不是退出应用程序,则登录 { if (!this.userLoginPanel1.IsDisposed) //如果登录进度显示组件未释放 { this.userLoginPanel1.Start(); //则显示登录进度 } this.Show(); //显示主窗口 this.auth = frmLogin.auth; //将当前登录参数设置为最新的 this.controlPanel1.Login(auth, false); //登录 } frmLogin = null; } catch (Exception ex) { IMLibrary3.Global.MsgShow(ex.Message + ex.Source); } }
/// <summary> /// 准备登录 /// </summary> private void ReadyLogin(bool IsRepeat) { try { this.Hide(); if (frmLogin == null || frmLogin.IsDisposed) frmLogin = new FormLogin(); frmLogin.IsRepeat = IsRepeat; if (IsRepeat && this.auth != null)//如果是重复登录,则更改登录参数 frmLogin.SetLoginParameter(this.auth); frmLogin.ShowDialog(); if (frmLogin.isExit)//如果退出应用程序 { this.ExitApp();//退出应用程序 } else//如果不是退出应用程序,则登录 { if (!this.userLoginPanel1.IsDisposed)//如果登录进度显示组件未释放 this.userLoginPanel1.Start();//则显示登录进度 this.Show();//显示主窗口 this.auth = frmLogin.auth;//将当前登录参数设置为最新的 this.controlPanel1.Login(auth, false);//登录 } frmLogin = null; } catch (Exception ex) { IMLibrary3.Global.MsgShow(ex.Message + ex.Source); } }