Ejemplo n.º 1
0
    /// <summary>
    /// Shows a configuration dialog for an object.
    /// </summary>
    /// <param name="controller">The controller to show in the dialog</param>
    /// <param name="title">The title of the dialog to show.</param>
    /// <param name="showApplyButton">If true, the "Apply" button is visible on the dialog.</param>
    /// <returns>True if the object was successfully configured, false otherwise.</returns>
    public override bool ShowDialog(IMVCAController controller, string title, bool showApplyButton)
    {

      if (controller.ViewObject == null)
      {
        FindAndAttachControlTo(controller);
      }

      if (controller.ViewObject == null)
        throw new ArgumentException("Can't find a view object for controller of type " + controller.GetType());

      if (controller is Altaxo.Gui.Scripting.IScriptController)
      {
        System.Windows.Forms.Form dlgctrl = new Altaxo.Gui.Scripting.ScriptExecutionDialogWin((Altaxo.Gui.Scripting.IScriptController)controller);
        return (System.Windows.Forms.DialogResult.OK == dlgctrl.ShowDialog(MainWindow));
      }
      else
      {
        DialogShellView dlgview = new DialogShellView((System.Windows.Forms.UserControl)controller.ViewObject);
        DialogShellController dlgctrl = new DialogShellController(dlgview, controller, title, showApplyButton);
        return DialogResult.OK == dlgview.ShowDialog(MainWindow);
      }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows a configuration dialog for an object.
        /// </summary>
        /// <param name="controller">The controller to show in the dialog</param>
        /// <param name="title">The title of the dialog to show.</param>
        /// <param name="showApplyButton">If true, the "Apply" button is visible on the dialog.</param>
        /// <returns>True if the object was successfully configured, false otherwise.</returns>
        public override bool ShowDialog(IMVCAController controller, string title, bool showApplyButton)
        {
            if (controller.ViewObject == null)
            {
                FindAndAttachControlTo(controller);
            }

            if (controller.ViewObject == null)
            {
                throw new ArgumentException("Can't find a view object for controller of type " + controller.GetType());
            }

            if (controller is Altaxo.Gui.Scripting.IScriptController)
            {
                System.Windows.Forms.Form dlgctrl = new Altaxo.Gui.Scripting.ScriptExecutionDialogWin((Altaxo.Gui.Scripting.IScriptController)controller);
                return(System.Windows.Forms.DialogResult.OK == dlgctrl.ShowDialog(MainWindow));
            }
            else
            {
                DialogShellView       dlgview = new DialogShellView((System.Windows.Forms.UserControl)controller.ViewObject);
                DialogShellController dlgctrl = new DialogShellController(dlgview, controller, title, showApplyButton);
                return(DialogResult.OK == dlgview.ShowDialog(MainWindow));
            }
        }