// Occurs whenever attempt to retrieve user data has been canceled.
            private void OnCancelToRetrieveUserData(object sender, UserUsernameEventArgs e)
            {
                // Displays appropriate logs informing user that application canceled obtaining user data.
                this._consolesServices.OnRetrievingUserDataCanceled(sender, e);
                this._consolesServices.OnBackToIdle(sender, e);

                // Clears info boxes
                this._dataDisplayServices.ClearInfoBoxes(sender, e);

                // Clears the content of all of the main form text boxes displaying User/Satur5 etc. data.
                this._dataDisplayServices.ClearAllDataDisplayTextBoxes(sender, e);

                // Enable appropriate controls.
                this._controlsEnabler.OnEmergencyAllocateSaturn5BySerialNumber_CancelToRetrieveUserData(sender, e);
            }
Exemplo n.º 2
0
            // Occurs whenever validation of the value provided by the user has been canceled.
            private void OnProvidedUsernameValidationCanceled(object sender, UserUsernameEventArgs e)
            {
                // Stop listening for username text box input.
                this.StopListenForUsernameInput();

                // Enables/Disables appropriate controls.
                this._controlsEnabler.OnAllocateSaturn5ByShortId_ProvidedUsernameValidationCanceled(sender, e);

                // Displays appropriate logs informing
                this._consolesServices.OnAllocateSaturn5ByShortId_ProvidedUsernameValidationCanceled(sender, e);
                this._consolesServices.OnBackToIdle(sender, e);

                // Clears the content of all of the main form text boxes displaying User/Satur5 etc. data.
                this._dataDisplayServices.ClearAllDataDisplayTextBoxes(sender, e);

                // Clears info boxes
                this._dataDisplayServices.ClearInfoBoxes(sender, e);
            }
Exemplo n.º 3
0
            // Occurs whenever application failed to retrieve user data.
            private void OnFailToRetrieveUserData(object sender, UserUsernameEventArgs e)
            {
                // Displays appropriate logs informing user that application failed to obtaining user data based on the provided username.
                this._consolesServices.OnRetrievingUserDataFailed(sender, e);

                // Ask user what to do in case of failure
                DialogResult result = MessageBox.Show($"Application failed to obtain user data using provided username: {e.Username} {Environment.NewLine}Would You like to Retry or Cancel the operation?", "Failed to obtain user data.", MessageBoxButtons.RetryCancel);

                switch (result)
                {
                case DialogResult.Cancel:
                    this.OnCancelToRetrieveUserData(sender, e);
                    break;

                case DialogResult.Retry:
                    this.OnValidUsernameProvided(sender, e);
                    break;
                }
            }
Exemplo n.º 4
0
            // Occurs when user will provide valid username. (Or reattempt to log in after failure.)
            private void OnValidUsernameProvided(object sender, UserUsernameEventArgs e)
            {
                // Stop listening for user username
                this.StopListenForUsernameInput();

                // Displays appropriate logs informing user about valid username being provided.
                this._consolesServices.OnAllocateSaturn5ByShortId_ValidUsernameProvided(sender, e);

                // Disables user username input text box
                this._controlsEnabler.OnAllocateSaturn5ByShortId_ValidUsernameProvided(sender, e);

                // Displays appropriate logs informing user that application began to obtaining user data based on the provided username
                this._consolesServices.OnRetrievingUserDataBegan(sender, e);

                // Set text boxes according to the current state of the UITask.
                this._dataDisplayServices.OnRetrievingUserDataBegan(sender, e);

                // Attempts to obtain user...
                Task <User> getUserTask = this._userServices.GetAsync(e.Username);

                getUserTask.ContinueWith((t) =>
                {
                    switch (t.Status)
                    {
                    case TaskStatus.RanToCompletion:
                        // ... execute if succeed to obtain user data.
                        this.OnSuccessfullyRetrievedUserData(sender, new UserEventArgs(t.Result));
                        break;

                    case TaskStatus.Faulted:
                        // ... execute if failed to obtain user data.
                        this.OnFailToRetrieveUserData(sender, e);
                        break;

                    case TaskStatus.Canceled:
                        // ... execute if attempt to obtain user data has been canceled.
                        this.OnCancelToRetrieveUserData(sender, e);
                        break;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Exemplo n.º 5
0
            public void OnRetrievingUserDataBegan(object sender, UserUsernameEventArgs e)
            {
                if (this._form.InvokeRequired)
                {
                    Action <object, UserUsernameEventArgs> d = new Action <object, UserUsernameEventArgs>(OnRetrievingUserDataBegan);
                    if (!this._form.IsDisposed)
                    {
                        this._form.Invoke(d, sender, e);
                    }
                }
                else if (!this._form.IsDisposed)
                {
                    // Pre-Brief tab
                    this.tbxPreBriefUserUsername.Text = e.Username;
                    this.tbxPreBriefUserType.Clear();
                    this.tbxPreBriefUserFirstName.Clear();
                    this.tbxPreBriefUserSurname.Clear();

                    // De-Brief tab
                    this.tbxDeBriefUserUsername.Text = e.Username;
                    this.tbxDeBriefUserType.Clear();
                    this.tbxDeBriefUserFirstName.Clear();
                    this.tbxDeBriefUserSurname.Clear();

                    // Options tab
                    this.tbxOptionsUserUsername.Text = e.Username;
                    this.tbxOptionsUserType.Clear();
                    this.tbxOptionsUserFirstName.Clear();
                    this.tbxOptionsUserSurname.Clear();

                    // Admin tab
                    this.tbxAdminUserUsername.Text = e.Username;
                    this.tbxAdminUserType.Clear();
                    this.tbxAdminUserFirstName.Clear();
                    this.tbxAdminUserSurname.Clear();
                }
            }
Exemplo n.º 6
0
            private void StopListenForUsernameInput()
            {
                if (this.tbxPreBriefUserUsername.InvokeRequired)
                {
                    Action d = new Action(StopListenForUsernameInput);
                    if (!this.tbxPreBriefUserUsername.IsDisposed)
                    {
                        this.tbxPreBriefUserUsername.Invoke(d);
                    }
                }
                else if (!this.tbxPreBriefUserUsername.IsDisposed)
                {
                    this.AwaitingUsernameCanceled   -= this.OnAwaitingUsernameCanceled;
                    this.ValidatingUsernameCanceled -= this.OnProvidedUsernameValidationCanceled;
                    this.tbxPreBriefUserUsername.InputValidationBegan      -= this.OnProvidedUsernameValidationBegan;
                    this.tbxPreBriefUserUsername.InputValidationFailed     -= this.OnProvidedUsernameValidationFailed;
                    this.tbxPreBriefUserUsername.InputValidationCanceled   -= this.OnProvidedUsernameValidationCanceled;
                    this.tbxPreBriefUserUsername.ValidInputValueProvided   -= this.OnValidUsernameProvided;
                    this.tbxPreBriefUserUsername.EmptyInputValueProvided   -= this.OnEmptyUsernameProvided;
                    this.tbxPreBriefUserUsername.InvalidInputValueProvided -= this.OnInvalidUsernameProvided;

                    this._usernameValidationCancelationArgs = null;
                }
            }
Exemplo n.º 7
0
            private void ChangeCancelationMethodForUsernameInput(UserUsernameEventArgs e)
            {
                if (this.tbxPreBriefUserUsername.InvokeRequired)
                {
                    Action <UserUsernameEventArgs> d = new Action <UserUsernameEventArgs>(ChangeCancelationMethodForUsernameInput);
                    if (!this.tbxPreBriefUserUsername.IsDisposed)
                    {
                        this.tbxPreBriefUserUsername.Invoke(d, e);
                    }
                }
                else if (!this.tbxPreBriefUserUsername.IsDisposed)
                {
                    this._usernameValidationCancelationArgs = e;

                    this.AwaitingUsernameCanceled -= this.OnAwaitingUsernameCanceled;
                    //this.AwaitingUsernameCanceled += this.OnAwaitingUsernameCanceled;

                    this.ValidatingUsernameCanceled -= this.OnProvidedUsernameValidationCanceled;
                    this.ValidatingUsernameCanceled += this.OnProvidedUsernameValidationCanceled;

                    this.tbxPreBriefUserUsername.InputValidationCanceled -= this.OnProvidedUsernameValidationCanceled;
                    this.tbxPreBriefUserUsername.InputValidationCanceled += this.OnProvidedUsernameValidationCanceled;
                }
            }
Exemplo n.º 8
0
 // Occurs whenever user will provide invalid username.
 private void OnInvalidUsernameProvided(object sender, UserUsernameEventArgs e)
 {
     // Displays appropriate logs informing user about invalid username being provided.
     this._consolesServices.OnAllocateSaturn5ByShortId_InvalidUsernameProvided(sender, e);
 }
Exemplo n.º 9
0
 // Occurs whenever user will provide empty value in place of valid username.
 private void OnEmptyUsernameProvided(object sender, UserUsernameEventArgs e)
 {
     // Displays appropriate logs informing user about empty username input being provided.
     this._consolesServices.OnRemoveUser_EmptyUsernameProvided(sender, e);
 }
 // Occurs whenever user will provide empty value in place of valid username.
 private void OnEmptyUsernameProvided(object sender, UserUsernameEventArgs e)
 {
     // Displays appropriate logs informing user about empty username input being provided.
     this._consolesServices.OnEmergencyAllocateSaturn5BySerialNumber_EmptyUsernameProvided(sender, e);
 }