Exemplo n.º 1
0
        public void ReviewResults(string process = null)
        {
            //process can have 1,2 or 3 value
            reviewResultsCurrentProcess = process;
            var name = "ReviewML" + reviewResultsCurrentProcess;

            _views.MainForm.ReviewMLOpenedFromStart = false;


            int viewIndex = viewsManager.GetViewIndex(name);

            if (viewIndex < 0)
            {
                //All ok

                downloadWorker = new BackgroundWorker();
                downloadWorker.WorkerSupportsCancellation = true;
                downloadWorker.WorkerReportsProgress      = true;
                downloadWorker.RunWorkerCompleted        += downloadWorker_RunWorkerCompleted;
                downloadWorker.ProgressChanged           += downloadWorker_ProgressChanged;

                downloadWorker.DoWork += downloadWorker_DoWork;

                fgSVM = new FormGenerateSVMProgress();
                fgSVM.btnCancel.Enabled = false;

                downloadWorker.RunWorkerAsync();

                fgSVM.ShowDialog();
            }
            else
            {
                viewsManager.ActivateView(viewIndex);
            }
        }
Exemplo n.º 2
0
        void btnReconnect_Click(object sender, EventArgs e)
        {
            fgSVM = new FormGenerateSVMProgress();
            fgSVM.SetProgressStyle(ProgressBarStyle.Marquee);


            using (BackgroundWorker bw = new BackgroundWorker())
            {
                bw.DoWork += (senderM, eM) =>
                {
                    this.Cursor = Cursors.WaitCursor;
                    try
                    {
                        var processName = Properties.Settings.Default.ProcessName.ToString();

                        if (!String.IsNullOrEmpty(processName))
                        {
                            StartService();

                            bool finished = client.Reconnect(processName);

                            if (finished)
                            {
                                _paneSVM.EnableReviewButton(processName[0].ToString());
                            }
                        }
                        else
                        {
                            MessageBox.Show(this, "No process to reconect to!", "Process don't exists", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch
                    {
                        MessageBox.Show(this, "Unable to reconnect to server!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                };
                bw.RunWorkerCompleted += (senderM, em) =>
                {
                    this.Cursor = Cursors.Default;
                    fgSVM.Close();
                    fgSVM.Dispose();
                };


                bw.RunWorkerAsync();
                fgSVM.ShowDialog();
            };
        }