예제 #1
0
        /// <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 dialog box with the specified arguments.
        /// </summary>
        internal WorkspaceDialogBox AddNew(DialogBoxCreationArgs args)
        {
            var dialogBox = CreateDialogBox(args);

            Open(dialogBox);
            return(dialogBox);
        }
        /// <summary>
        /// Creates a new <see cref="WorkspaceDialogBox"/>.
        /// </summary>
        private WorkspaceDialogBox CreateDialogBox(DialogBoxCreationArgs args)
        {
            var factory = CollectionUtils.FirstElement <IWorkspaceDialogBoxFactory>(
                (new WorkspaceDialogBoxFactoryExtensionPoint()).CreateExtensions()) ?? new DefaultWorkspaceDialogBoxFactory();

            return(factory.CreateWorkspaceDialogBox(args, _owner));
        }
예제 #4
0
        /// <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);
        }
예제 #5
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);
 }
예제 #6
0
        /// <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());
        }
예제 #7
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;
		}
예제 #8
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;
		}
예제 #9
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));
        }
예제 #10
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="component">The application component to launch.</param>
        /// <param name="title">The title of the dialog box.</param>
        /// <returns>The exit code that the component exits with.</returns>
        public static ApplicationComponentExitCode LaunchAsDialog(
            IDesktopWindow desktopWindow,
            IApplicationComponent component,
            [param: Localizable(true)] string title)
        {
            var args = new DialogBoxCreationArgs(component, title, null);

            return(LaunchAsDialog(desktopWindow, args));
        }
예제 #11
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));
 }
예제 #12
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);
        }
예제 #13
0
파일: Workspace.cs 프로젝트: nhannd/Xian
		/// <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);
		}
예제 #14
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));
        }
예제 #15
0
 /// <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));
 }
예제 #16
0
 public DialogBox CreateDialogBox(DialogBoxCreationArgs args, DesktopWindow window)
 {
     return(new DialogBox(args, window));
 }
		private static DialogBoxCreationArgs CreateArgs()
		{
			DialogBoxCreationArgs args = new DialogBoxCreationArgs();
			args.Component = new DummyComponent();
			args.SizeHint = DialogSizeHint.Auto;
			return args;
		}
예제 #18
0
파일: DialogBox.cs 프로젝트: nhannd/Xian
        /// <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);
		}
예제 #19
0
		public void Customize()
		{
			try
			{
				if (SettingsStore.IsSupported && !SettingsStore.IsStoreOnline)
				{
					base.Context.DesktopWindow.ShowMessageBox(Desktop.SR.MessageSettingsStoreOffline, MessageBoxActions.Ok);
					return;
				}

				CustomizeViewerActionModelsComponent component = new CustomizeViewerActionModelsComponent(this.ImageViewer);

				DialogBoxCreationArgs args = new DialogBoxCreationArgs(component, SR.TitleCustomizeActionModels, "CustomizeActionModels")
				                             	{
				                             		AllowUserResize = true
				                             	};
				ApplicationComponent.LaunchAsDialog(this.Context.DesktopWindow, args);
			}
			catch (Exception ex)
			{
				ExceptionHandler.Report(ex, SR.MessageActionModelUpdateFailure, Context.DesktopWindow);
			}
		}