Inheritance: MahApps.Metro.Controls.MetroWindow
コード例 #1
0
        public override void TryLogin(string UserId, SecureString Password)
        {
            this.UserId = UserId;
            this.Password = Password;

            if (!IsManual) {
                if (UserId.Length == 0 || Password.Length == 0) {
                    OnCompleted(LoginCode.WRONG_USER, string.Empty, UserId);
                    return;
                }
            } else {
                WebWindow = App.Kernel.Get<WebWindow>();
                WebWindow.Title = App.Kernel.Get<ILanguageManager>().Model.Settings_Account_Manual_Auth;
                WebWindow.Closed += (s, e) => OnCompleted(LoginCode.CANCELLED, string.Empty, UserId);
                Browser = WebWindow.Browser;
            }

            LoginAttemptNum = 0;
            Browser.DocumentCompleted += LoginDocumentCompleted;
            Browser.Navigate(AUTH_ENTRY_POINT);
            OnStateChanged(LoginState.LOGINNING);
            if (IsManual) {
                WebWindow.ShowDialog();
            }
        }
コード例 #2
0
 protected override void OnCompleted(LoginCode code, string arguments, string UserId)
 {
     if (IsManual && WebWindow != null) {
         WebWindow.Close();
         WebWindow = null;
     }
     base.OnCompleted(code, arguments, UserId);
 }