void frmMain_VisibleChanged(object sender, EventArgs e) { if (!frmMain.Visible && !this.Visible) { TSCommon.SetSkin("Office 2013"); this.Show(); } }
/// <summary> /// 加载皮肤设置内容 /// </summary> private bool InitSkin() { //string skin_name = ConfigHelper.GetConfigString("skin_name", TSCommon.Default_skin_name, true); TSCommon.SetSkin("Office 2013"); return(true); }
private void btnLogin_Click(object sender, EventArgs e) { if (!dxvalidation.Validate() || string.IsNullOrWhiteSpace(txtUid.Text)) { DXMessageBox.ShowInfo("用户名和密码不能为空!", this); } else { this.loginPress.Show(); btnLogin.Enabled = btnCancel.Enabled = chkRember.Enabled = btnSet.Enabled = false; this.CrossThreadCallsSync(x => { this.loginPress.Hide(); btnLogin.Enabled = btnCancel.Enabled = chkRember.Enabled = btnSet.Enabled = true; DocInfo docInfo = x as DocInfo; if (docInfo == null) { DXMessageBox.ShowError("获取登录信息失败!\r\n请检查网络连接", this); } else { switch (docInfo.err_Code) { case -2: DXMessageBox.ShowError("无法连接到服务器,请检查网络连接或重试!", this); break; case -1: DXMessageBox.ShowError("参数错误!请重试", this); break; case 1: DXMessageBox.ShowWarning("用户名不存在!", this); txtUid.Focus(); break; case 2: DXMessageBox.ShowWarning("密码错误!", this); txtPwd.Focus(); break; case 3: DXMessageBox.ShowWarning("该用户已经在其它地方登录!", this); break; case 4: DXMessageBox.ShowError("客户端版本低,请升级客户端!", this); break; case 0: //登陆成功 #region 本地记住用户名和密码 if (chkRember.Checked) { string uidmd5 = DESEncrypt.Encrypt(txtUid.Text); string pwdmd5 = DESEncrypt.Encrypt(txtPwd.Text); ConfigHelper.UpdateConfig("u", uidmd5, true); ConfigHelper.UpdateConfig("p", pwdmd5, true); } #endregion #region 返回值解析 TmoComm.login_docInfo = docInfo; if (frmMain != null) { frmMain.Initfunction(); } #endregion #region 设置主窗体显示 this.Hide(); string skin_name = ConfigHelper.GetConfigString("skin_name", TSCommon.Default_skin_name, true); TSCommon.SetSkin(skin_name); frmMain.Show(); #endregion TCPClient.Instance.SendHeartBeat(); //登录成功后 主动发送心跳包 break; default: LogHelper.Log.Error("未知错误->错误码:" + docInfo.err_Code); DXMessageBox.ShowError("未知错误!错误码:" + docInfo.err_Code, this); break; } } }, () => { return(Tmo_CommonClient.Instance.GetDocInfo(txtUid.Text, txtPwd.Text)); }); } }