public void Deactivate(bool forward)
 {
     if (TransportWorker.IsBusy)
     {
         TransportWorker.CancelAsync();
     }
     if (!forward)
     {
         ErrorPanel.Hide();
         SuccessPanel.Hide();
         FinishedInfoLabel.Hide();
         MainForm.Instance.FinishEnabled = false;
     }
 }
        private void TransportWorker_DoWork(object sender, DoWorkEventArgs args)
        {
            var transport = SharedData.Instance.Transport;

            transport.ProgressChanged += transport_ProgressChanged;
            try
            {
                transport.Execute(TransportWorker);
            }
            finally
            {
                transport.ProgressChanged -= transport_ProgressChanged;
            }

            if (TransportWorker.CancellationPending)
            {
                args.Cancel = true;
                return;
            }
            TransportWorker.ReportProgress(1000);
        }
Ejemplo n.º 3
0
        public void Activate(bool forward)
        {
            if (forward)
            {
                finished = false;
                if (!TransportWorker.IsBusy)
                {
                    RemainingTimeLabel.Text = Tx.T("msg.starting");
                    TransportWorker.RunWorkerAsync();
                }
                else
                {
                    MessageBox.Show(
                        Tx.T("msg.previous operation"),
                        Tx.T("msg.title.error"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }

            UpdateButtons();
        }
 private void transport_ProgressChanged(object sender, ProgressChangedEventArgs args)
 {
     TransportWorker.ReportProgress(args.ProgressPercentage);
 }