Example #1
0
        private void subscriptionWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            var error = e.Result as QueryErrorResult;

            if (error != null)
            {
                queryStatusBar1.UpdateValues(0, TimeSpan.Zero);
                queryStatusBar1.UpdateStatusLabel("Error");

                ShowTabs(Tabs.Log);
                logTextbox.Text = error.Log;
                MessageBox.Show(this, error.ErrorMessage, "SWQL Studio", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #2
0
        /// <summary>Interprets the results from the background worker</summary>
        private void LoginBW_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            Form.Close();
            Enabled = true;

            //Check if we're connected
            if (!Connection.Connected)
            {
                MessageBox.Show("Could not connect to the server!", "LBL", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //Switch on login result.
            switch (Result)
            {
            case SwitchboardClient.LoginResult.SUCCESS:
                //We've successfully connected. Launch the de-esta cosa

                //Launch the mainform
                MainForm Haha = new MainForm(Connection);
                Hide();
                Haha.ShowDialog();
                Show();
                Connection.Close();

                break;

            case SwitchboardClient.LoginResult.INVALID:
                Connection.Close();
                MessageBox.Show("Invalid Login Credentials", "LBL", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case SwitchboardClient.LoginResult.ALREADY:
                Connection.Close();
                //These shouldn't happen
                MessageBox.Show("?", "This isn't supposed to happen", MessageBoxButtons.OK, MessageBoxIcon.Question);
                break;

            case SwitchboardClient.LoginResult.OTHERLOCALE:
                Connection.Close();
                MessageBox.Show("Already logged in on another client.", "LBL", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            default:
                Connection.Close();
                MessageBox.Show("?", "This isn't supposed to happen", MessageBoxButtons.OK, MessageBoxIcon.Question);
                break;
            }
        }
        private void BG_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (StrainAL != null)
            {
                foreach (String thisStrain in StrainAL)
                {
                    StrainListBox.Items.Add(thisStrain);
                }
            }

            if (StrainListBox.Items.Count > 0)
            {
                StrainListBox.SelectedIndex = 0;
            }
        }
Example #4
0
 void _bgwUI_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         MessageBox.Show(e.Error.ToString(), "出错", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (e.Cancelled)
     {
         MessageBox.Show("任务已取消", "取消", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         MessageBox.Show("任务完成。结果:" + e.Result, "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Example #5
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     // 如果导出过程没有出现任何异常,那么导出成功,2个打开按钮变为可用。
     // 否则显示错误对话框。
     if (e.Error == null)
     {
         btnOpenFile.Enabled   = true;
         btnOpenFolder.Enabled = true;
     }
     else
     {
         Commons.ShowErrorBox(this, e.Error.Message);
         Close();
     }
 }
Example #6
0
 private void bgwEditProject_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Result == null)
     {
         DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         lockUi(true);
         Session.showMessage(this,
                             ((Exception)e.Result).Message, Session.localizeMessage("serverError", this),
                             MessageBoxIcon.Error, MessageBoxButtons.OK);
     }
 }
Example #7
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            circularProgress1.IsRunning = false;
            circularProgress1.Visible   = false;
            btnReporte.Enabled          = true;

            dataGridViewX1.DataSource = resumen;


            MessageBoxEx.EnableGlass = false;
            MessageBoxEx.Show("Ejercicio Realizado", "EK Report SEMP", MessageBoxButtons.OK, MessageBoxIcon.Information);


            //diseñoDeResultado(resumen);
        }
 void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         label1.Text = "Processing Cancelled";
     }
     else if (e.Error != null)
     {
         MessageBox.Show(e.Error.Message);
     }
     else
     {
         label1.Text = "Sum=" + e.Result.ToString();
     }
 }
Example #9
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     // 如果导出过程没有出现任何异常,那么导入成功,对话框结果为OK。
     // 否则显示错误对话框,对话框结果为Cancel。
     if (e.Error == null)
     {
         DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     else
     {
         Commons.ShowErrorBox(this, e.Error.Message);
         DialogResult = System.Windows.Forms.DialogResult.Cancel;
     }
     Close();
 }
Example #10
0
        void root_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            DateTime dt = DateTime.Now;
            TimeSpan ts = dt - startTime;

            textBox1.Text += "\n" + "かかった時間:" + ts.ToString();
            if (RunWorkerCompleted != null)
            {
                RunWorkerCompleted(this, e);
            }
            if (showCompleteMessageBox)
            {
                MessageBox.Show("完了しました。");
            }
        }
Example #11
0
        private void bgwLoad_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (!string.IsNullOrEmpty(_errorMessage))
            {
                MessageBox.Show(_errorMessage, "Peringatan");
            }
            else
            {
                MessageBox.Show("Generate XML Sukses", "Perhatian");
                DialogResult = DialogResult.Yes;
                Close();
            }

            pbProccess.Hide();
        }
Example #12
0
        void bw_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            this.IsEnabled = true;

            if (e.Result != null)
            {
                Exception ex = e.Result as Exception;
                MessageBox.Show(ex.Message);
            }
            else
            {
                MessageBox.Show("Success!\n An Email Has Been Sent To: " + TextBox_Email.Text);
                Close();
            }
        }
Example #13
0
 void bgwLogin_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if ((e.Result is userAccount))
     {
         Result       = (e.Result as userAccount);
         DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         lockUi(true);
         Session.showMessage(this, ((Exception)e.Result).Message, "Während dem Login ist ein Problem aufgetreten",
                             MessageBoxIcon.Error, MessageBoxButtons.OK);
     }
 }
 // +-+-+-+-+-+-+-+-+-+-+-+-+herşey Tamamlanınca +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         MessageBox.Show("İptal Edildi !", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
         progressBar1.Style = ProgressBarStyle.Continuous;
         progressBar1.Value = 0;
     }
     else
     {
         MessageBox.Show("Arama İşlemi Tamamlandı !", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information);
         progressBar1.Style = ProgressBarStyle.Continuous;
         progressBar1.Value = 0;
     }
 }
Example #15
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     ResGrid.DataSource          = result;
     circularProgress1.Visible   = false;
     circularProgress1.IsRunning = false;
     btnCancel.Visible           = false;
     buttonX3.Enabled            = true;
     buttonX6.Enabled            = true;
     buttonX4.Enabled            = true;
     buttonX5.Enabled            = true;
     MessageBox.Show(
         "Terminado", "AudSemp",
         MessageBoxButtons.OK,
         MessageBoxIcon.Information);
 }
Example #16
0
        private void bwProgress_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            switch ((string)e.Result)
            {
            case "import":
                ImportPopup.ImportComplete();
                //MainForm.lbList.SelectedItems.Clear();
                //if (MainForm.lbList.Items.Count > 0) MainForm.lbList.SelectedIndex = 0;
                break;

            case "recrypt":
                ReCryptPopup.RecryptComplete();
                break;
            }
        }
        private void bgwSave_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            this.Enabled = true;

            if (e.Result is Exception)
            {
                this.ShowError("Proses simpan data kendaraan gagal!");
                FormHelpers.CurrentMainForm.UpdateStatusInformation("simpan data kendaraan gagal", true);
            }
            else
            {
                FormHelpers.CurrentMainForm.UpdateStatusInformation("simpan data kendaraan selesai", true);
                this.Close();
            }
        }
Example #18
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled == true)
     {
         label1.Text = "Canceled!";
     }
     else if (e.Error != null)
     {
         label1.Text = "Error: " + e.Error.Message;
     }
     else
     {
         label2.Text = "Done!";
     }
 }
Example #19
0
        void ExportBWRunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (_pleaseWait != null)
            {
                try{ _pleaseWait.Close(); }catch (Exception) {}
            }

            if (e.Error != null)
            {
                MessageBox.Show("Error while loading data: " + e.Error.ToString());
                return;
            }

            MessageBox.Show("Export Complete");
        }
Example #20
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     MatchResultShow();
     this.pictureBox1.Visible   = this.pictureBox2.Visible = false;
     this.krbtnOpenFile.Enabled = true;
     this.krbtnMatching.Enabled = true;
     this.krtraceDegree.Enabled = true;
     this.krbtnMinus.Enabled    = true;
     this.krbtnPlus.Enabled     = true;
     this.krbtnNewTXT.Enabled   = true;
     if (!this.tsslStatus.Text.StartsWith("Error"))
     {
         this.tsslStatus.Text = "分析完毕.";
     }
 }
        private void scansionatore_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            StatoScansione ss = (StatoScansione)e.Result;

            if (ss.totale == 0)
            {
                this.messaggio = "Nessuna foto trovata con i parametri indicati";
            }
            else
            {
                this.messaggio = String.Format("Scansionate {0,4} foto di {1,4}.\r\nTrovati {2,4} barcode", ss.attuale, ss.totale, ss.barcodeTrovati);
            }

            scansionareStop();
        }
Example #22
0
        private void bgCustomerSignUp_RunWorkerCompleted(object sender,
                                                         System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            panelIndicator.Visible = false;

            btnOK.Enabled = true;

            MessageBox.Show(
                "Thanks for signing up with POSTCL software. A confimation will be sent to your email shortly ",
                "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);

            Refresh();

            this.Close();
        }
Example #23
0
        private void bgSave_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            btnNuevaEntrada.ImageIndex = 8;
            btnNuevaEntrada.Text       = "Nueva entrada";
            EnableControls(false);

            if (!bgLoad.IsBusy)
            {
                splash.Show();
                bgLoad.RunWorkerAsync();
            }

            trans = true;
            MessageBox.Show("Transacción realizada correctamente!");
        }
        private void bgWorkerDatabase_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            //desabilita os botões enquanto a tarefa é executada.
            this.btnAddAliquot.Enabled = true;
            //this.btnAddDept.Enabled = true;
            this.btnSaveContract.Enabled = true;

            //Carrega todo progressbar.
            pbSaveDatabase.MarqueeAnimationSpeed = 0;
            pbSaveDatabase.Style = ProgressBarStyle.Blocks;
            pbSaveDatabase.Value = 100;

            //informa que a tarefa esta sendo executada.
            this.lblWaiting.Text = "";
        }
Example #25
0
        private void bgWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (_mailSent)
            {
                lblMessage.ForeColor = Color.DarkGreen;
                lblMessage.Text      = Resources.SuccessMsg;
            }
            else
            {
                lblMessage.ForeColor = Color.Red;
                lblMessage.Text      = Resources.ErrorMsg;
            }

            lblMessage.Image = null;
        }
Example #26
0
 void backgroundUpdater_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     progress.Value = 100;
     if (errorList.Count > 0)
     {
         string errors = "Errors:\n";
         foreach (string error in errorList)
         {
             errors += error + "\n";
         }
         MessageBox.Show(errors);
     }
     this.Close();
     this.Dispose();
 }
Example #27
0
        private void ConvertJsonWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                XmlImported = null;
                MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                XmlImported = e.Result.ToString();
                txtXml.Text = XmlImported;
            }

            EnableControl(true);
        }
Example #28
0
 void BackgroundWorker1RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled == true)
     {
         MessageBox.Show("Wątek został anulowany", "Wątki", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         string[] Wynik = (string[])e.Result;
         foreach (string Linia in Wynik)
         {
             richTextBox1.AppendText(Linia + "\n");
         }
     }
 }
Example #29
0
 private void backgroundWorker2_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     frmWrite.Hide();
     if (string.IsNullOrEmpty(this.error_WorkForNewTxt))
     {
         FormWritingDone frmWDone = new FormWritingDone();
         frmWDone.Show();
         this.tsslStatus.Text = "生成新档成功.";
     }
     else
     {
         this.tsslStatus.Text = "生成新档失败.";
         MessageBox.Show(this.error_WorkForNewTxt, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #30
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            this.metroProgressSpinner1.Visible = false;

            this.dgvValidation.DataSource = dtFailCells;

            if (dtFailCells.Rows.Count > 0)
            {
                MetroMsgBoxUtil.Warning(this, String.Format("有 {0} 个单元格的内容未通过校验。", dtFailCells.Rows.Count), "Warning");
            }
            else
            {
                MetroMsgBoxUtil.Success(this, "数据校验通过", "Success");
            }
        }
        public void Run_BackgroundWorkerCancelsProcess_OnCancelledIsCalledBySyncContext()
        {
            // arrange
            var eventArgs = new System.ComponentModel.RunWorkerCompletedEventArgs(null, null, true);

            Mock<Action> onCancelledMock = new Mock<Action>();
            onCancelledMock.Setup(x => x());

            // act
            _worker.Run(new RandomizerWorkerSettings(), (x) => { }, (y) => { }, onCancelledMock.Object);
            _backgroundWorkerMock.Raise(x => { x.OnRunWorkerCompleted += null; }, null, eventArgs);

            // assert
            onCancelledMock.Verify(x => x(), Times.Once);
        }
        public void Run_BackgroundWorkerSuccessfullyFinishesProcess_OnFinishedIsCalledBySyncContext()
        {
            // arrange
            object result = new List<AppFile>();
            var eventArgs = new System.ComponentModel.RunWorkerCompletedEventArgs(result, null, false);

            Mock<Action<List<AppFile>>> onFinishedMock = new Mock<Action<List<AppFile>>>();
            onFinishedMock.Setup(x => x((List<AppFile>)result));

            // act
            _worker.Run(new RandomizerWorkerSettings(), onFinishedMock.Object, (y) => { }, () => { });
            _backgroundWorkerMock.Raise(x => { x.OnRunWorkerCompleted += null; }, null, eventArgs);

            // assert
            onFinishedMock.Verify(x => x((List<AppFile>)result), Times.Once);
        }
Example #33
0
 private void updateListDownloader_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
        {
     if (!(e.Error is OperationCanceledException))
      MessageBox.Show(this, e.Error.Message, S._("Eraser"), MessageBoxButtons.OK,
       MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
       S.IsRightToLeft(this) ?
        MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign : 0);
     Close();
     return;
        }
        progressPanel.Visible = false;
        updatesPanel.Visible = true;
        IList<DownloadInfo> downloads = (IList<DownloadInfo>)e.Result;
        updatesLv.Groups.Add(DownloadType.Update.ToString(), S._("Updates"));
        updatesLv.Groups.Add(DownloadType.Plugin.ToString(), S._("Plugins"));
        updatesLv.Groups.Add(DownloadType.Build.ToString(), S._("Nightly builds"));
        List<string> architectures = new List<string>();
        {
     architectures.Add("any");
     switch (SystemInfo.ProcessorArchitecture)
     {
      case ProcessorArchitecture.Amd64:
       architectures.Add("x64");
       break;
      case ProcessorArchitecture.IA64:
       architectures.Add("ia64");
       break;
      case ProcessorArchitecture.X86:
       architectures.Add("x86");
       break;
     }
        }
        foreach (DownloadInfo download in downloads)
        {
     if (architectures.IndexOf(download.Architecture) == -1)
      continue;
     ListViewGroup group = updatesLv.Groups[download.Type.ToString()];
     ListViewItem item = new ListViewItem(download.Name);
     item.SubItems.Add(download.Version.ToString());
     item.SubItems.Add(download.Publisher);
     item.SubItems.Add(FileSize.ToString(download.FileSize));
     item.Tag = download;
     item.Group = group;
     item.Checked = true;
     updatesLv.Items.Add(item);
        }
        updatesBtn.Enabled = updatesLv.Items.Count > 0;
        if (updatesLv.Items.Count == 0)
        {
     MessageBox.Show(this, S._("There are no new updates or plugins available for " +
      "Eraser."), S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Information,
      MessageBoxDefaultButton.Button1,
      S.IsRightToLeft(this) ?
       MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign : 0);
     Close();
        }
 }
        public void Run_BackgroundWorkerThrewError_OnFailedIsCalledBySyncContext()
        {
            // arrange
            Exception error = new Exception("test");
            var eventArgs = new System.ComponentModel.RunWorkerCompletedEventArgs(null, error, false);

            Mock<Action<string>> onFailedMock = new Mock<Action<string>>();
            onFailedMock.Setup(x => x(error.Message));

            _worker.Run(new RandomizerWorkerSettings(), (x) => { }, onFailedMock.Object, () => { });

            // act
            _backgroundWorkerMock.Raise(x => { x.OnRunWorkerCompleted += null; }, null, eventArgs);

            // assert
            onFailedMock.Verify(x => x(error.Message), Times.Once);
        }
Example #35
0
 private void downloader_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
        {
     if (!(e.Error is OperationCanceledException))
      MessageBox.Show(this, e.Error.Message, S._("Eraser"),
       MessageBoxButtons.OK, MessageBoxIcon.Error,
       MessageBoxDefaultButton.Button1,
       S.IsRightToLeft(this) ?
        MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign : 0);
     Close();
     return;
        }
        downloadingPnl.Visible = false;
        installingPnl.Visible = true;
        foreach (DownloadUIInfo download in DownloadItems.Values)
        {
     download.ListViewItem.Remove();
     installingLv.Items.Add(download.ListViewItem);
     if (download.Error == null)
      download.ListViewItem.SubItems[1].Text = string.Empty;
     else
      download.ListViewItem.SubItems[1].Text = S._("Error: {0}", download.Error.Message);
        }
        installer.RunWorkerAsync(e.Result);
 }
        public void Run_BackgroundWorkerSuccessfullyFinishesProcess_OnFinishedIsCalledBySyncContext()
        {
            // arrange
            var eventArgs = new System.ComponentModel.RunWorkerCompletedEventArgs(null, null, false);

            Mock<Action> onFinishedMock = new Mock<Action>();
            onFinishedMock.Setup(x => x());
            _parameters.OnFinished = onFinishedMock.Object;

            // act
            _worker.Run(_parameters);
            _backgroundWorkerMock.Raise(x => { x.OnRunWorkerCompleted += null; }, null, eventArgs);

            // assert
            onFinishedMock.Verify(x => x(), Times.Once);
        }
Example #37
0
 private void installer_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error is OperationCanceledException)
     Close();
        installingPnl.UseWaitCursor = false;
 }