Exemple #1
0
        private void Feedback(object sender, SendingReportFeedbackEventArgs e)
        {
            switch (e.Step)
            {
            case SendingReportStep.PreparingReport:
                if (e.Failed)
                {
                    preparingFeedback.Stop(e.ErrorMessage);
                    retrySending.Visible = true;
                    retrySending.Focus();
                    buttonSaveAsFile.Visible = true;
                }
                else
                {
                    preparingFeedback.Start();
                }
                break;

            case SendingReportStep.ConnectingToServer:
                if (e.Failed)
                {
                    connectingFeedback.Stop(e.ErrorMessage);
                    retrySending.Visible = true;
                    retrySending.Focus();
                    buttonSaveAsFile.Visible = true;
                }
                else
                {
                    preparingFeedback.Stop();
                    connectingFeedback.Start();
                }
                break;

            case SendingReportStep.Transfering:
                if (e.Failed)
                {
                    waitSendingReport.Visible = false;
                    transferingFeedback.Stop(e.ErrorMessage);
                    retrySending.Visible = true;
                    retrySending.Focus();
                    buttonSaveAsFile.Visible = true;
                }
                else
                {
                    connectingFeedback.Stop();
                    transferingFeedback.Start();
                    waitSendingReport.Visible = true;
                }
                break;

            case SendingReportStep.Finished:
                waitSendingReport.Visible = false;
                transferingFeedback.Stop();
                completedFeedback.Stop();
                ok.Enabled = true;
                ok.Focus();
                cancelSending.Enabled = false;
                break;
            }
        }
Exemple #2
0
        private void Feedback(object sender, SendingReportFeedbackEventArgs e)
        {
            Button failureButton = alreadyRetried && Thread.CurrentThread.GetApartmentState() == ApartmentState.STA ? saveReport : retrySending;

            switch (e.Step)
            {
            case SendingReportStep.PreparingReport:
                if (e.Failed)
                {
                    preparingFeedback.Stop(e.ErrorMessage);
                    failureButton.Visible = true;
                    failureButton.Focus();
                }
                else
                {
                    preparingFeedback.Start();
                }
                break;

            case SendingReportStep.ConnectingToServer:
                if (e.Failed)
                {
                    connectingFeedback.Stop(e.ErrorMessage);
                    failureButton.Visible = true;
                    failureButton.Focus();
                }
                else
                {
                    preparingFeedback.Stop();
                    connectingFeedback.Start();
                }
                break;

            case SendingReportStep.Transfering:
                if (e.Failed)
                {
                    waitSendingReport.Visible = false;
                    transferingFeedback.Stop(e.ErrorMessage);
                    failureButton.Visible = true;
                    failureButton.Focus();
                }
                else
                {
                    connectingFeedback.Stop();
                    transferingFeedback.Start();
                    waitSendingReport.Visible = true;
                }
                break;

            case SendingReportStep.Finished:
                waitSendingReport.Visible = false;
                transferingFeedback.Stop();
                completedFeedback.Stop();
                ok.Enabled = true;
                ok.Focus();
                cancelSending.Enabled = false;
                break;
            }
        }