Ejemplo n.º 1
0
 private void Enter_Click(object sender, RoutedEventArgs e)
 {
     this.LoginResult = false;
     if (e.Source == this.Enter)
     {
         if (this._IsLogging)
         {
             TXLog.TXLog3("Login", " Enter_Click 重复");
         }
         else
         {
             if (this.passwordHash == null)
             {
                 string str      = (this.accounts.SelectedIndex >= 0x0) ? (this.accounts.SelectedItem.ToString()) : this.accounts.Text;
                 string password = this.passwordBox.Password.Trim();
                 if ((str.Length == 0x0) || (password.Length == 0x0))
                 {
                     string messageBoxText = "帐号或者密码不能为空";
                     string caption        = "提示";
                     MessageBox.Show(messageBoxText, caption);
                     return;
                 }
                 this.passwordHash = CoreMessenger.CalculatePasswordHash(password);
                 this.passwordType = IMPwdType.IMPWD_HASHONE;
             }
             if (CoreMessenger.Instance.TM.IsValidAccount(this.accounts.Text))
             {
                 if (App.Messenger.Login(this.accounts.Text, this.passwordHash, this.passwordType, this.LoginStatus))
                 {
                     this._IsLogging = true;
                     this.ShowInputFrame(false);
                     e.Handled = true;
                 }
                 else
                 {
                     //Util_MessageBox.InvalidUinMsg(this, this.accounts.Text);
                 }
             }
             else
             {
                 string str5 = "请输入正确的QQ号码。";
                 string str6 = "提示";
                 MessageBox.Show(str5, str6);
                 this.accounts.Text = "";
                 this.passwordBox.Clear();
                 this.accounts.Focus();
             }
         }
     }
     else if (e.Source == this.btnCancel)
     {
         this._IsLogging = false;
         this.ShowInputFrame(true);
         App.Messenger.CancelLogin();
     }
 }
Ejemplo n.º 2
0
 private void OnLogin(object sender, LoginEventArgs e)
 {
     if (e.Succeeded)
     {
         TXLog.TXLog3("Login", string.Format("登录成功回调 _IsLogging={0}", this._IsLogging));
         base.Opacity = 0.0;
         this.btnCancel.Visibility = Visibility.Hidden;
         if (Util_Buddy.GetCurrentBuddy() != null)
         {
             this.accountManager.SetAccountInfo(Util_Buddy.GetCurrentBuddy().Uin, this.LoginStatus);
         }
         this.InitPlugincenter();
         if (base.IsLoaded)
         {
             CoreMessenger.Instance.TM.EventProcessing(AsyncHandle_Type.AsyncHandle_AutoUpdateMgr, 0x1, null);
             this.LoginResult = true;
             base.Close();
         }
     }
     else
     {
         this.ShowInputFrame(true);
         LoginFailedEventArgs loginFailedEventArgs = e as LoginFailedEventArgs;
         if (loginFailedEventArgs != null)
         {
             if (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_CANCEL)
             {
                 TXLog.TXLog3("Login", "取消登录回调");
             }
             else
             {
                 string messageBoxText = this.MakeLoginMessage(loginFailedEventArgs);
                 string caption        = "登录失败";
                 MessageBox.Show(messageBoxText, caption);
                 if (((loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_SERVER_REFUSE) || (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_PWD_EXPIRE1)) || (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_PWD_EXPIRE2))
                 {
                     this.passwordBox.Clear();
                     this.passwordBox.Focus();
                 }
                 else if (loginFailedEventArgs.Code == LoginCallbackCode.IM_LOGINFAIL_EXISTSAMEAPP)
                 {
                     this.accounts.Focus();
                 }
             }
         }
     }
     this._IsLogging = false;
 }