Exemplo n.º 1
0
            // Occurs whenever create saturn 5 report has been provided and required to be committed.
            private void OnReportDataUploadRequired(object sender, CreateSaturn5EventArgs e)
            {
                // Displays appropriate logs/application state/user instructions text to the user.
                this._consolesServices.OnCreateSaturn5_UploadingReportDataBegan(sender, e);

                // Attempt to commit create saturn 5 data
                Task createSaturn5Task = this._saturn5Services.CreateAsync(e.SerialNumber, e.ShortId, e.PhoneNumber);

                createSaturn5Task.ContinueWith((t) =>
                {
                    switch (t.Status)
                    {
                    case TaskStatus.RanToCompletion:
                        // ... execute if saturn 5 receive from IT has been committed successfully
                        this.OnReportDataUploadSucceed(sender, e);
                        break;

                    case TaskStatus.Faulted:
                        // ... execute if saturn 5 receive from IT has fail to commit
                        this.OnReportDataUploadFailed(sender, e);
                        break;

                    case TaskStatus.Canceled:
                        // ... execute if saturn 5 receive from IT has been canceled to commit
                        this.OnReportDataUploadCanceled(sender, e);
                        break;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Exemplo n.º 2
0
            // Occurs whenever saturn 5 received from IT data get uploaded successfully
            private void OnReportDataUploadSucceed(object sender, CreateSaturn5EventArgs e)
            {
                // Displays appropriate logs informing user that application successfully committed the data.
                this._consolesServices.OnCreateSaturn5_ReportDataUploadSucceed(sender, e);

                // Enables/Disables appropriate controls.
                this._controlsEnabler.OnCreateSaturn5_ReportDataUploadSucceed(sender, e);
            }
Exemplo n.º 3
0
            // Occurs whenever create saturn 5 data failed to get uploaded.
            private void OnReportDataUploadFailed(object sender, CreateSaturn5EventArgs e)
            {
                // Displays appropriate logs informing user about failed data upload.
                this._consolesServices.OnCreateSaturn5_ReportDataUploadFailed(sender, e);

                // Informs user about application failed to create saturn 5 and as such being unable to continue.
                MessageBox.Show("Application failed to create saturn 5 and add it into the depot stock and must be closed.", "Create Saturn 5 failed.", MessageBoxButtons.OK);

                // Close the application.
                this._form.Close();
            }
Exemplo n.º 4
0
            // Occurs whenever create saturn 5 data canceled to get uploaded.
            private void OnReportDataUploadCanceled(object sender, CreateSaturn5EventArgs e)
            {
                // Displays appropriate logs informing user that application canceled data upload
                this._consolesServices.OnCreateSaturn5_ReportDataUploadCanceled(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);

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