コード例 #1
0
        /// <summary>
        /// This submits a bit of SAS code to run PROC IOMOPERATE
        /// The code is submitted asynchronously, so a cancel dialog is shown
        /// in case it runs longer than the user wants to wait
        /// </summary>
        private void RefreshProcesses()
        {
            string connectUrl = string.Format(SpawnerUrl, txtHost.Text, txtPort.Text, txtUser.Text, txtPW.Text);
            string code = SAS.Tasks.Toolkit.Helpers.UtilityFunctions.ReadFileFromAssembly("SAS.Tasks.SASProcesses.prociomoperate.sas");
            code = connectUrl + code;
            SasSubmitter s = new SasSubmitter(Consumer.AssignedServer);
            if (!s.IsServerBusy())
            {
                _savedCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;
                s.SubmitSasProgramComplete += handle_SubmitSasProgramComplete;
                sasJobId = s.SubmitSasProgram(code);

                // show the Progress dialog with cancel button
                progressdlg = new SubmitProgressForm();
                if (progressdlg.ShowDialog(this) == DialogResult.Cancel)
                {
                    s.CancelJob(sasJobId);
                    progressdlg = null;
                }
            }
            else
                MessageBox.Show(string.Format("The server {0} is busy; cannot check server processes.", Consumer.AssignedServer));
        }
コード例 #2
0
        // Job done!
        private void handle_SubmitSasProgramComplete(object sender, SubmitCompleteEventArgs args)
        {
            // use BeginInvoke to move processing back to UI thread
            BeginInvoke(new MethodInvoker(
                delegate()
                {
                    // Close progress dialog if needed
                    if (progressdlg != null && progressdlg.Visible)
                    {
                        progressdlg.Close();
                        progressdlg = null;
                    }
                    sasJobId = -1;
                    Cursor.Current = _savedCursor;

                    if (args.Success)
                    {
                        SaveSettings();
                        AddProcesses();
                        UpdateKillButton();
                    }
                    else
                    {
                        // ERROR - provide option to show the SAS log
                        if (DialogResult.Yes ==
                        MessageBox.Show("An error occurred while trying to retrieve the list of processes.  Would you like to view the error log?",
                            "Error",
                            MessageBoxButtons.YesNo))
                        {
                            SAS.Tasks.Toolkit.Controls.SASLogViewDialog logView =
                                new SASLogViewDialog("Error log", "PROC IOMOPERATE log:", args.Log);
                            logView.ShowDialog(this);
                        };
                    }

                }
            ));
        }