Exemplo n.º 1
0
        /// <summary>
        /// Show the progress dialog to to the user.
        /// </summary>
        /// <param name="task">The <see cref="BackgroundTask"/> to execute.</param>
        /// <param name="desktopWindow">Desktop window that parents the progress dialog.</param>
        /// <param name="autoClose">Close the progress dialog after task completion.</param>
        /// <param name="progressBarStyle">The style of the progress bar.</param>
        public static void Show(BackgroundTask task, IDesktopWindow desktopWindow, bool autoClose = true, ProgressBarStyle progressBarStyle = ProgressBarStyle.Blocks, string startProgressMessage = null)
        {
            // as the progress dialog involves UI, the task should *always* be run under the application UI culture
            task.ThreadUICulture = Application.CurrentUICulture;

            var progressComponent = new ProgressDialogComponent(task, autoClose, progressBarStyle, startProgressMessage);
            ApplicationComponentExitCode result = ApplicationComponent.LaunchAsDialog(
                desktopWindow,
                progressComponent,
                Application.Name);

            if (result == ApplicationComponentExitCode.Error)
            {
                throw progressComponent.TaskException;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Show the alert viewer shelf.
 /// </summary>
 public void Show()
 {
     if (_shelf == null)
     {
         _shelf = ApplicationComponent.LaunchAsShelf(
             this.Context.DesktopWindow,
             new AlertViewerComponent(),
             SR.TitleAlertViewer,
             ShelfName,
             ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);
         _shelf.Closed += (sender, args) => _shelf = null;
     }
     else
     {
         _shelf.Activate();
     }
 }
Exemplo n.º 3
0
        void Shelf2()
        {
            if (_shelf2 == null)
            {
                TestComponent component = new TestComponent("Shelf2");
                _shelf2 = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    component,
                    "Shelf 2",
                    "Shelf2",
                    ShelfDisplayHint.DockFloat);

                _shelf2.Closed += delegate { _shelf2 = null; };
            }
            else
            {
                _shelf2.Activate();
            }
        }
Exemplo n.º 4
0
        void Shelf1()
        {
            if (_shelf1 == null)
            {
                TestComponent component = new TestComponent("Shelf1");
                _shelf1 = ApplicationComponent.LaunchAsShelf(
                    this.Context.DesktopWindow,
                    component,
                    "Shelf 1",
                    "Shelf1",
                    ShelfDisplayHint.DockFloat | ShelfDisplayHint.DockLeft | ShelfDisplayHint.HideOnWorkspaceOpen);

                _shelf1.Closed += delegate { _shelf1 = null; };
            }
            else
            {
                _shelf1.Activate();
            }
        }
        private void ShowShelf(DesktopWindow window)
        {
            // the shelf is not currently open
            if (_closeHelperShelf == null)
            {
                // launch it
                CloseHelperComponent component = new CloseHelperComponent();
                _closeHelperShelf = ApplicationComponent.LaunchAsShelf(window, component,
                                                                       SR.TitleCloseAssistant,
                                                                       "Close Assistant",
                                                                       ShelfDisplayHint.DockLeft);
                _closeHelperShelf.Closed += delegate { _closeHelperShelf = null; };
            }
            else
            {
                _closeHelperShelf.Activate();
            }

            CloseHelperComponent helper = (CloseHelperComponent)_closeHelperShelf.Component;

            helper.Refresh();
        }
 void Launch()
 {
     if (_workspace == null)
     {
         try
         {
             DesktopMonitorComponent component = new DesktopMonitorComponent();
             _workspace = ApplicationComponent.LaunchAsWorkspace(
                 this.Context.DesktopWindow,
                 component,
                 "Desktop Monitor");
             _workspace.Closed += delegate { _workspace = null; };
         }
         catch (Exception e)
         {
             ExceptionHandler.Report(e, this.Context.DesktopWindow);
         }
     }
     else
     {
         _workspace.Activate();
     }
 }
Exemplo n.º 7
0
 internal ApplicationComponentMetaToolContext(ApplicationComponent component, DesktopWindow window)
 {
     _component = component;
     _window    = window;
 }
Exemplo n.º 8
0
 public void ShowWorkspaceDialogBox()
 {
     ApplicationComponent.LaunchAsWorkspaceDialog(this.Host.DesktopWindow, new TestComponent("WorkspaceDialog from " + _name), "WorkspaceDialog from " + _name);
 }