public void ReadPassword() { string[] values = RegistryOper.ReadUserNamePassword(); if (values != null) { this.txtUserName.Text = values[0]; this.txtPassword.Password = values[1]; this.chkRememberPwd.IsChecked = true; } else { this.chkRememberPwd.IsChecked = false; } }
private void LoginAync() { if (!CryptEncoder.Ready) { //MyMessageBox.ShowInfo("正在初始化,请等待..."); return; } if (this.txtUserName.Text.Length == 0) { MyMessageBox.ShowInfo("请输入用户名"); return; } if (this.txtPassword.Password.Length == 0) { MyMessageBox.ShowInfo("请输入密码"); return; } string userLoginName = this.txtUserName.Text.Trim(); string password = this.txtPassword.Password; RegistryOper.SaveUserNamePassword(userLoginName, password, this.chkRememberPwd.IsChecked.Value); GlobalData.InitToken(null); #if DEBUG GlobalData.Client.Init(GlobalData.DebugServer); #else string serverUri = ""; #if Test serverUri = System.Configuration.ConfigurationManager.AppSettings["ServerUriTest"]; GlobalData.ServerType = ServerType.Server1; #else //if (this.cmbServer.SelectedIndex == 0) //{ // serverUri = System.Configuration.ConfigurationManager.AppSettings["ServerUri1"]; // GlobalData.ServerType = ServerType.Server1; //} //else //{ serverUri = System.Configuration.ConfigurationManager.AppSettings["ServerUri2"]; GlobalData.ServerType = ServerType.Server2; //} #endif if (string.IsNullOrEmpty(serverUri)) { MyMessageBox.ShowInfo("找不到服务器Uri地址,请联系系统管理员,或者安装最新版本。"); return; } GlobalData.Client.Init(serverUri); #endif string mac = GetMac(); App.BusyToken.ShowBusyWindow("正在加载..."); string clientVersion = System.Configuration.ConfigurationManager.AppSettings["softwareversion"]; GlobalData.Client.Login(userLoginName, password, CryptEncoder.Key, mac, clientVersion); }