/// <summary>
        /// Creates a new dialog box with the specified arguments.
        /// </summary>
        internal DialogBox AddNew(DialogBoxCreationArgs args)
        {
            DialogBox dialog = CreateDialogBox(args);

            Open(dialog);
            return(dialog);
        }
        /// <summary>
        /// Creates a new <see cref="DialogBox"/>.
        /// </summary>
        private DialogBox CreateDialogBox(DialogBoxCreationArgs args)
        {
            IDialogBoxFactory factory = CollectionUtils.FirstElement <IDialogBoxFactory>(
                (new DialogBoxFactoryExtensionPoint()).CreateExtensions()) ?? new DefaultDialogBoxFactory();

            return(factory.CreateDialogBox(args, _owner));
        }
Beispiel #3
0
 /// <summary>
 /// Executes the specified application component in a modal dialog box.  This call will block until
 /// the dialog box is closed.
 /// </summary>
 /// <remarks>
 /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
 /// will be propagate to the caller of this method and the component will not be launched.
 /// </remarks>
 /// <param name="desktopWindow">The desktop window in which the dialog box is centered.</param>
 /// <param name="creationArgs">A <see cref="DialogBoxCreationArgs"/> object.</param>
 /// <returns>The exit code that the component exits with.</returns>
 public static ApplicationComponentExitCode LaunchAsDialog(
     IDesktopWindow desktopWindow,
     DialogBoxCreationArgs creationArgs)
 {
     desktopWindow.ShowDialogBox(creationArgs);
     return(creationArgs.Component.ExitCode);
 }
        /// <summary>
        /// Creates a new dialog box with the specified arguments.
        /// </summary>
        internal WorkspaceDialogBox AddNew(DialogBoxCreationArgs args)
        {
            var dialogBox = CreateDialogBox(args);

            Open(dialogBox);
            return(dialogBox);
        }
Beispiel #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="args"></param>
 /// <param name="workspace"></param>
 protected internal WorkspaceDialogBox(DialogBoxCreationArgs args, Workspace workspace)
     : base(args)
 {
     _workspace = workspace;
     _host      = new Host(this, args.Component);
     _size      = args.Size;
     _sizeHint  = args.SizeHint;
 }
        /// <summary>
        /// Shows a dialog box in front of this window.
        /// </summary>
        /// <param name="args">Creation helper object.</param>
        /// <returns>The button the user selected to dismiss the dialog.</returns>
        public DialogBoxAction ShowDialogBox(DialogBoxCreationArgs args)
        {
            AssertState(new[] { DesktopObjectState.Open, DesktopObjectState.Closing });

            DialogBox dialog = _dialogs.AddNew(args);

            return(dialog.RunModal());
        }
Beispiel #7
0
        /// <summary>
        /// Executes the specified application component in a workspace dialog.
        /// </summary>
        /// <remarks>
        /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
        /// will be propagate to the caller of this method and the component will not be launched.
        /// </remarks>
        /// <param name="desktopWindow">The desktop window that owns the active workspace in which the dialog is launched.</param>
        /// <param name="component">The application component to launch.</param>
        /// <param name="title">The title of the dialog.</param>
        /// <returns>The newly created dialog box object.</returns>
        public static WorkspaceDialogBox LaunchAsWorkspaceDialog(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            string title)
        {
            var args = new DialogBoxCreationArgs(component, title, null);

            return(LaunchAsWorkspaceDialog(desktopWindow, args));
        }
Beispiel #8
0
 /// <summary>
 /// Executes the specified application component in a workspace dialog.
 /// </summary>
 /// <remarks>
 /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
 /// will be propagate to the caller of this method and the component will not be launched.
 /// </remarks>
 /// <param name="desktopWindow">The desktop window that owns the active workspace in which the dialog is launched.</param>
 /// <param name="creationArgs">A <see cref="DialogBoxCreationArgs"/> object.</param>
 /// <returns>The newly created dialog object.</returns>
 public static WorkspaceDialogBox LaunchAsWorkspaceDialog(
     IDesktopWindow desktopWindow,
     DialogBoxCreationArgs creationArgs)
 {
     if (desktopWindow.ActiveWorkspace == null)
     {
         throw new InvalidOperationException("There is no active workspace.");
     }
     return(desktopWindow.ActiveWorkspace.ShowDialogBox(creationArgs));
 }
Beispiel #9
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="args">Creation args for the dialog box.</param>
        /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the dialog box.</param>
        protected internal DialogBox(DialogBoxCreationArgs args, DesktopWindow desktopWindow)
            : base(args)
        {
            _component       = args.Component;
            _dialogSize      = args.SizeHint;
            _size            = args.Size;
            _allowUserResize = args.AllowUserResize;
            _desktopWindow   = desktopWindow;

            _host = new Host(this, _component);
        }
Beispiel #10
0
        /// <summary>
        /// Shows a dialog box in front of this workspace.
        /// </summary>
        /// <param name="args">Arguments used to create the dialog box.</param>
        /// <returns>The newly created dialog box object.</returns>
        public WorkspaceDialogBox ShowDialogBox(DialogBoxCreationArgs args)
        {
            AssertState(new[] { DesktopObjectState.Open, DesktopObjectState.Closing });

            return(_dialogBoxes.AddNew(args));
        }
 /// <summary>
 /// Creates a new dialog box for the specified arguments.
 /// </summary>
 /// <param name="args">Arguments that control the creation of the dialog.</param>
 /// <param name="workspace">The workspace with which the dialog is associated.</param>
 /// <returns>A new dialog instance.</returns>
 public WorkspaceDialogBox CreateWorkspaceDialogBox(DialogBoxCreationArgs args, Workspace workspace)
 {
     return(new WorkspaceDialogBox(args, workspace));
 }
 public DialogBox CreateDialogBox(DialogBoxCreationArgs args, DesktopWindow window)
 {
     return(new DialogBox(args, window));
 }