예제 #1
0
 private void ViewModel_AuthenticationStatusIndication
     (object sender, Library.Model.AuthorizeDetailEventArgs e)
 {
     if (e.IsAuthenticated)
     {
         //unsubscribe from form closing event since there is not need to exit the application on form closing
         FormClosing -= OnClosingSignIn;
         //Raise an event indicating that the user is authorized.
         UserAuthorized?.Invoke(this, e);
         //close the authentication form
         this.Close();
     }
     else
     {
         //show a message that auth failed
         if (e.Message != null)
         {
             XtraMessageBox.Show(e.Message);
         }
         else
         {
             XtraMessageBox.Show("Invalid username or password! Please try again.");
         }
         //hide authenticating animation
         SetNormalUiState();
         //Clear out the textedits and get focus to username
         ClearOutUiAndFocusUsername();
     }
 }
예제 #2
0
파일: MainView.cs 프로젝트: SwatInc/CD4
        private async void AuthView_UserAuthorized(object sender, Library.Model.AuthorizeDetailEventArgs e)
        {
            //Todo: assign this via MainViewModel by databinding
            barStaticItemUsernameAndRole.Caption = $"Welcome {e.FullName} ({e.UserRole})";
            EvaluateMainViewAuth();

            try
            {
                //Get result alert configuration
                var alertData = await _viewModel.GetResultAlertData();

                ResultAlertModelCollection.ResultAlertData.AddRange(alertData);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show($"An error occured while loading result alert data.\n{ex.Message}");
            }
        }