Beispiel #1
0
        /// <summary>
        /// Method for calling process command
        /// </summary>
        /// <param name="dlg">Dialog to design and process command</param>
        private void DesignAndProcessCommand(Epi.Windows.Analysis.Dialogs.CommandDesignDialog dlg)
        {
            #region Input Validation
            if (dlg == null)
            {
                throw new System.ArgumentNullException("dlg");
            }
            #endregion  Input Validation

            try
            {
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    //Some dialogs may not generate a command. No need to process command if command text is empty.
                    if (!string.IsNullOrEmpty(dlg.CommandText))
                    {
                        if (CommandGenerated != null)
                        {
                            Epi.Windows.Analysis.Forms.CommandProcessingMode Mode = (Epi.Windows.Analysis.Forms.CommandProcessingMode) dlg.ProcessingMode;
                            CommandGenerated(dlg.CommandText, Mode);
                        }
                    }
                    dlg.Close();
                }
            } //try
            finally
            {
                //fix defect 279
                if (this.tvCommands.SelectedNode.Parent != null)
                {
                    tvCommands.SelectedNode = this.tvCommands.SelectedNode.Parent;
                }
                else
                {
                    throw new System.ArgumentNullException("Parent node is null");
                }

                // dcs0 TODO - I don't think this should be here
                //programEditor.SavePGM(Files.LastPgm);
            }//finally
        }
Beispiel #2
0
 private string ShowCommandDesignDialog(Epi.Windows.Analysis.Dialogs.CommandDesignDialog dialog)
 {
     DialogResult result = dialog.ShowDialog();
     if (result == DialogResult.OK)
     {
         return (dialog.CommandText + Environment.NewLine);
     }
     return string.Empty;
 }