Exemplo n.º 1
0
 public void CloseActiveSmartPart()
 {
     if ((ActiveWorkspace != null) && (ActiveWorkspace.ActiveSmartPart != null))
     {
         ActiveWorkspace.Close(ActiveWorkspace.ActiveSmartPart);
     }
 }
Exemplo n.º 2
0
            /// <summary>
            /// Closes the active <see cref="IWorkspace"/>.
            /// </summary>
            public void CloseWorkspace()
            {
                IDesktopWindow window          = this.Context.DesktopWindow;
                IWorkspace     activeWorkspace = window.ActiveWorkspace;

                if (activeWorkspace != null)
                {
                    activeWorkspace.Close();
                }
            }
Exemplo n.º 3
0
        protected virtual void CloseView()
        {
            IWorkspaceLocatorService locator = WorkItem.Services.Get <IWorkspaceLocatorService>();
            IWorkspace wks = locator.FindContainingWorkspace(WorkItem, View);

            if (wks != null)
            {
                wks.Close(View);
            }
        }
Exemplo n.º 4
0
        public void CloseOptionDetailView(object sender, EventArgs e)
        {
            IWorkspaceLocatorService locator = WorkItem.Services.Get <IWorkspaceLocatorService>();
            IWorkspace wks = locator.FindContainingWorkspace(WorkItem, sender);

            if (wks != null)
            {
                wks.Close(sender);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Re-starts the homepage, close any existing open homepage.
        /// </summary>
        protected void Restart()
        {
            if (_workspace != null)
            {
                _workspace.Close();
                _workspace = null;
            }

            Open();
        }
Exemplo n.º 6
0
        private void CloseViewCommandExecutedEventHandler(object sender, ExecutedRoutedEventArgs e)
        {
            object smartPart = ((ContentControl)((FrameworkElement)((FrameworkElement)e.OriginalSource).Parent).TemplatedParent).Content;

            IWorkspaceLocatorService locator = WorkItem.Services.Get <IWorkspaceLocatorService>();
            IWorkspace workspace             = locator.FindContainingWorkspace(WorkItem, smartPart);

            if (workspace != null)
            {
                workspace.Close(smartPart);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 关闭视图
        /// </summary>
        protected virtual void CloseView()
        {
            IWorkspaceLocatorService locator = WorkItem.Services.Get <IWorkspaceLocatorService>();

            if (locator != null)
            {
                IWorkspace wp = locator.FindContainingWorkspace(workItem, view);
                if (wp != null)
                {
                    wp.Close(view);
                }
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Closes the smart part.
        /// </summary>
        /// <typeparam name="TView"></typeparam>
        /// <param name="id">The id.</param>
        public void CloseSmartPart <TView>(string id)
        {
            IWorkspace wp = WorkItem.Workspaces.Get(UIExtensionSiteNames.Shell_Workspace_Taskbar);

            if (wp != null)
            {
                TView view = WorkItem.SmartParts.Get <TView>(id);
                if (view != null)
                {
                    wp.Close(view);
                }
            }
        }
Exemplo n.º 9
0
        public void AttemptLogin(object sender, EventArgs args)
        {
            _tokenCache.Flush();

            _mainWorkspace.Close(_loginView);
            _loginView = null;

            _welcomeView = new WelcomeView();

            _welcomeView.Presenter = new WelcomePresenter()
            {
                UserSessionService = UserSessionService,
                TokenCache         = _tokenCache,
                View = _welcomeView
            };

            _welcomeView.Presenter.LoginFailed     += LoginFailed;
            _welcomeView.Presenter.LoginSuccessful += LoginSuccessful;

            _mainWorkspace.Show(_welcomeView);
            _welcomeView.Login();
        }
Exemplo n.º 10
0
        public void CloseViewer(CloseViewerRequest request)
        {
            if (request == null)
            {
                string message = "The close viewer request cannot be null.";
                Platform.Log(LogLevel.Debug, message);
                throw new FaultException(message);
            }

            if (request.Viewer == null || request.Viewer.Identifier.Equals(Guid.Empty))
            {
                string message = "A valid viewer id must be specified.";
                Platform.Log(LogLevel.Debug, message);
                throw new FaultException(message);
            }

            IImageViewer viewer = ViewerAutomationTool.GetViewer(request.Viewer.Identifier);

            if (viewer == null)
            {
                string message = String.Format("The specified viewer ({0}) was not found, " +
                                               "likely because it has already been closed by the user.", request.Viewer.Identifier);
                Platform.Log(LogLevel.Debug, message);

                throw new FaultException <ViewerNotFoundFault>(new ViewerNotFoundFault(message), _viewerNotFoundReason);
            }

            IWorkspace workspace = GetViewerWorkspace(viewer);

            if (workspace == null)
            {
                string message = String.Format("The specified viewer ({0}) was found, " +
                                               "but it does not appear to be hosted in one of the active workspaces.", request.Viewer.Identifier);
                Platform.Log(LogLevel.Error, message);

                throw new FaultException <ViewerNotFoundFault>(new ViewerNotFoundFault(message), _viewerNotFoundReason);
            }

            try
            {
                workspace.Close(UserInteraction.NotAllowed);
            }
            catch (Exception e)
            {
                string message = String.Format("An unexpected error has occurred while attempting " +
                                               "to close the specified viewer ({0}).", request.Viewer.Identifier);
                Platform.Log(LogLevel.Error, e, message);
                throw new FaultException(message);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Launches the specified <see cref="ImageViewerComponent"/> using the <paramref name="window"/> parameter.
        /// </summary>
        public static void Launch(ImageViewerComponent imageViewer, IDesktopWindow window, string title)
        {
            IWorkspace workspace = LaunchAsWorkspace(window, imageViewer, title);

            imageViewer.ParentDesktopObject = workspace;
            try
            {
                imageViewer.Layout();
            }
            catch (Exception)
            {
                workspace.Close();
                throw;
            }
        }
Exemplo n.º 12
0
        public void CloseAllWorkspaces()
        {
            foreach (var workspace in _workspaceDictionary.Values)
            {
                foreach (var smartPart in workspace.SmartParts)
                {
                    workspace.Close(smartPart);
                }
            }

            foreach (var smartPart in _commonWorkspace.SmartParts)
            {
                _commonWorkspace.Close(smartPart);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Launches the specified <see cref="ImageViewerComponent"/> using the <paramref name="window"/> parameter.
        /// </summary>
        public static void Launch(ImageViewerComponent imageViewer, IDesktopWindow window, string title)
        {
            IWorkspace workspace = LaunchAsWorkspace(window, imageViewer, title);

            workspace.Closed += delegate {
                imageViewer.Dispose();
            };
            try
            {
                imageViewer.Layout();
            }
            catch (Exception)
            {
                workspace.Close();
                throw;
            }
        }
Exemplo n.º 14
0
        protected virtual void OnProgressUpdated(object state, int progressPercentage)
        {
            IDataView dataView = View as IDataView;

            if (dataView != null)
            {
                if (dataView.IsDetailView)
                {
                    dataView.UpdateProgress(progressPercentage);
                }
                else
                {
                    IWorkspace modalWorkspace = WorkItem.Workspaces["modalWorkspace"];

                    if (progressPercentage < 100)
                    {
                        if (progressView == null)
                        {
                            progressView = WorkItem.SmartParts.AddNew <SearchProgressView>();
                            progressView.CancelCallback = () =>
                            {
                                Cancel();
                            };

                            modalWorkspace.Show(progressView);
                        }
                    }
                    else
                    {
                        modalWorkspace.Close(progressView);
                        WorkItem.SmartParts.Remove(progressView);
                        progressView = null;
                    }
                }
            }
        }
 public void Close(object smartPart)
 {
     workspace.Close(smartPart);
 }