Esempio n. 1
0
            // Occurs whenever UITask required to retrieve saturn 5 data to proceed.
            private void OnRetrievingSaturn5DataRequired(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Displays appropriate logs informing user that application began to obtaining Saturn5 data based on the provided serial number
                this._consolesServices.OnRetrievingSaturn5DataBySerialNumberBegan(sender, e);

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

                // Attempt to obtain saturn 5 data...
                Task <Saturn5> getSaturn5Task = this._saturn5Services.GetBySerialNumberAsync(e.SerialNumber);

                getSaturn5Task.ContinueWith((t) =>
                {
                    switch (t.Status)
                    {
                    case TaskStatus.RanToCompletion:
                        // ... execute if succeed to obtain saturn 5 data.
                        this.OnSuccessfullyRetrievedSaturn5Data(sender, new Saturn5EventArgs(t.Result));
                        break;

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

                    case TaskStatus.Canceled:
                        // ... execute if attempt to obtain saturn 5 data has been canceled.
                        this.OnCancelToRetrieveSaturn5Data(sender, e);
                        break;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Esempio n. 2
0
            public void OnRetrievingSaturn5DataBySerialNumberBegan(object sender, Saturn5SerialNumberEventArgs e)
            {
                if (this._form.InvokeRequired)
                {
                    Action <object, Saturn5SerialNumberEventArgs> d = new Action <object, Saturn5SerialNumberEventArgs>(OnRetrievingSaturn5DataBySerialNumberBegan);
                    if (!this._form.IsDisposed)
                    {
                        this._form.Invoke(d, sender, e);
                    }
                }
                else if (!this._form.IsDisposed)
                {
                    // Pre-Brief tab
                    this.tbxPreBriefSaturn5SerialNumber.Text = e.SerialNumber;
                    this.tbxPreBriefSaturn5Barcode.Clear();

                    // De-Brief tab
                    this.tbxDeBriefSaturn5SerialNumber.Text = e.SerialNumber;
                    this.tbxDeBriefSaturn5Barcode.Clear();

                    // Options tab
                    this.tbxOptionsSaturn5SerialNumber.Text = e.SerialNumber;
                    this.tbxOptionsSaturn5Barcode.Clear();

                    // Saturn 5 Stock Management tab
                    this.tbxSaturn5SMSerialNumber.Text = e.SerialNumber;
                    this.tbxSaturn5SMBarcode.Clear();
                }
            }
Esempio n. 3
0
            // Occurs whenever validation of the value provided by the user failed, and the user didn't agree to retry.
            private void OnProvidedSerialNumberValidationFailed(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Displays appropriate logs informing user about empty serial number input being provided.
                this._consolesServices.OnReportSaturn5Fault_ProvidedSerialNumberValidationFailed(sender, e);

                // Close the application.
                this._form.Close();
            }
Esempio n. 4
0
            // Occurs whenever user pressed enter when appropriate for this UI task validation box is enable,
            // and right before a validation of provided by the user value will begin.
            private void OnProvidedSerialNumberValidationBegan(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Subscribe to appropriate method of canceling awaiting for input.
                this.ChangeCancelationMethodForSerialNumberInput(e);

                // Displays appropriate logs informing user about empty serial number input being provided.
                this._consolesServices.OnReportSaturn5Fault_ProvidedSerialNumberValidationBegan(sender, e);
            }
Esempio n. 5
0
            // Occurs whenever user provided valid serialNumber into the appropriate text box
            private void OnValidSerialNumberProvided(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Stop listening for saturn 5 serial number
                this.StopListenForSerialNumberInput();

                // Displays appropriate logs informing user about valid serial number being provided.
                this._consolesServices.OnReportSaturn5Fault_ValidSerialNumberProvided(sender, e);

                // Disables saturn 5 serial number input text box
                this._controlsEnabler.OnReportSaturn5Fault_ValidSerialNumberProvided(sender, e);

                // Proceed further into the UITask into the part where Saturn 5 Data is getting attempted to be retrieved using serial number.
                this.OnRetrievingSaturn5DataRequired(sender, e);
            }
Esempio n. 6
0
            // Occurs if retrieving saturn 5 data has been canceled
            private void OnCancelToRetrieveSaturn5Data(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Displays appropriate logs informing user that application canceled obtaining saturn 5 data.
                this._consolesServices.OnRetrievingSaturn5DataBySerialNumberCanceled(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.OnReportSaturn5Fault_CancelToRetrieveSaturn5Data(sender, e);
            }
Esempio n. 7
0
            // Occurs whenever validation of the value provided by the user has been canceled.
            private void OnProvidedSerialNumberValidationCanceled(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Stop listening for serial number text box input.
                this.StopListenForSerialNumberInput();

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

                // Displays appropriate logs informing user about empty serial number input being provided.
                this._consolesServices.OnReportSaturn5Fault_ProvidedSerialNumberValidationCanceled(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);
            }
Esempio n. 8
0
            // Occurs if application fails to obtain saturn 5 data
            private void OnFailToRetrieveSaturn5Data(object sender, Saturn5SerialNumberEventArgs e)
            {
                // Displays appropriate logs informing user that application failed to obtaining saturn 5 data.
                this._consolesServices.OnRetrievingSaturn5DataBySerialNumberFailed(sender, e);

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

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

                case DialogResult.Retry:
                    this.OnRetrievingSaturn5DataRequired(sender, e);
                    break;
                }
            }
Esempio n. 9
0
            private void StopListenForSerialNumberInput()
            {
                if (this.tbxSaturn5SMSerialNumber.InvokeRequired)
                {
                    Action d = new Action(StopListenForSerialNumberInput);
                    if (!tbxSaturn5SMSerialNumber.IsDisposed)
                    {
                        tbxSaturn5SMSerialNumber.Invoke(d);
                    }
                }
                else if (!this.tbxSaturn5SMSerialNumber.IsDisposed)
                {
                    this.AwaitingSerialNumberCanceled   -= this.OnAwaitingSerialNumberCanceled;
                    this.ValidatingSerialNumberCanceled -= this.OnProvidedSerialNumberValidationCanceled;
                    this.tbxSaturn5SMSerialNumber.InputValidationBegan      -= this.OnProvidedSerialNumberValidationBegan;
                    this.tbxSaturn5SMSerialNumber.InputValidationFailed     -= this.OnProvidedSerialNumberValidationFailed;
                    this.tbxSaturn5SMSerialNumber.InputValidationCanceled   -= this.OnProvidedSerialNumberValidationCanceled;
                    this.tbxSaturn5SMSerialNumber.ValidInputValueProvided   -= this.OnValidSerialNumberProvided;
                    this.tbxSaturn5SMSerialNumber.EmptyInputValueProvided   -= this.OnEmptySerialNumberProvided;
                    this.tbxSaturn5SMSerialNumber.InvalidInputValueProvided -= this.OnInvalidSerialNumberProvided;

                    this._serialNumberValidationCancelationArgs = null;
                }
            }
Esempio n. 10
0
            private void ChangeCancelationMethodForSerialNumberInput(Saturn5SerialNumberEventArgs e)
            {
                if (this.tbxSaturn5SMSerialNumber.InvokeRequired)
                {
                    Action <Saturn5SerialNumberEventArgs> d = new Action <Saturn5SerialNumberEventArgs>(ChangeCancelationMethodForSerialNumberInput);
                    if (!this.tbxSaturn5SMSerialNumber.IsDisposed)
                    {
                        this.tbxSaturn5SMSerialNumber.Invoke(d, e);
                    }
                }
                else if (!this.tbxSaturn5SMSerialNumber.IsDisposed)
                {
                    this._serialNumberValidationCancelationArgs = e;

                    this.AwaitingSerialNumberCanceled -= this.OnAwaitingSerialNumberCanceled;
                    //this.AwaitingSerialNumberCanceled += this.OnAwaitingSerialNumberCanceled;

                    this.ValidatingSerialNumberCanceled -= this.OnProvidedSerialNumberValidationCanceled;
                    this.ValidatingSerialNumberCanceled += this.OnProvidedSerialNumberValidationCanceled;

                    this.tbxSaturn5SMSerialNumber.InputValidationCanceled -= this.OnProvidedSerialNumberValidationCanceled;
                    this.tbxSaturn5SMSerialNumber.InputValidationCanceled += this.OnProvidedSerialNumberValidationCanceled;
                }
            }
Esempio n. 11
0
 // Occurs whenever user will provide invalid serial number.
 private void OnInvalidSerialNumberProvided(object sender, Saturn5SerialNumberEventArgs e)
 {
     // Displays appropriate logs informing user about invalid serial number being provided.
     this._consolesServices.OnReportSaturn5Fault_InvalidSerialNumberProvided(sender, e);
 }
 // Occurs whenever user will provide empty value in place of valid serial number.
 private void OnEmptySerialNumberProvided(object sender, Saturn5SerialNumberEventArgs e)
 {
     // Displays appropriate logs informing user about empty serial number input being provided.
     this._consolesServices.OnReportSaturn5Damage_EmptySerialNumberProvided(sender, e);
 }
 // Occurs whenever user will provide empty value in place of valid serial number.
 private void OnEmptySerialNumberProvided(object sender, Saturn5SerialNumberEventArgs e)
 {
     // Displays appropriate logs informing user about empty serial number input being provided.
     this._consolesServices.OnConfirmBackInFaultySaturn5BySerialNumber_EmptySerialNumberProvided(sender, e);
 }
Esempio n. 14
0
 // Occurs whenever user will provide invalid serial number.
 private void OnInvalidSerialNumberProvided(object sender, Saturn5SerialNumberEventArgs e)
 {
     // Displays appropriate logs informing user about invalid serial number being provided.
     this._consolesServices.OnConfirmBackInDamageSaturn5BySerialNumber_InvalidSerialNumberProvided(sender, e);
 }