Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        private void Feedback(object sender, SendingReportViaEmailFeedbackEventArgs e)
        {
            switch (e.Step)
            {
            case SendingReportViaEmailStep.PreparingReport:
                if (e.Failed)
                {
                    preparingFeedback.Stop(e.ErrorMessage);
                    retrySending.Visible = true;
                    retrySending.Focus();
                }
                else
                {
                    preparingFeedback.Start();
                }
                break;

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

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