コード例 #1
0
        private void RefreshUIState()
        {
            //Update the cursor
            WorkflowView parentView = ParentView;

            if (!CanContinueZooming)
            {
                parentView.Cursor = ZoomingMessageFilter.ZoomDisabledCursor;
            }
            else if (this.currentState == ZoomState.In)
            {
                parentView.Cursor = ZoomingMessageFilter.ZoomInCursor;
            }
            else
            {
                parentView.Cursor = ZoomingMessageFilter.ZoomOutCursor;
            }

            //Update the fast zoom
            if (this.fastZoomingMessageFilter == null && CanContinueZooming && this.currentState == ZoomState.In)
            {
                this.fastZoomingMessageFilter = new DragRectangleMessageFilter();
                this.fastZoomingMessageFilter.DragComplete += new EventHandler(OnZoomRectComplete);
                parentView.AddDesignerMessageFilter(this.fastZoomingMessageFilter);
            }
            else if (this.fastZoomingMessageFilter != null && (!CanContinueZooming || this.currentState != ZoomState.In))
            {
                this.fastZoomingMessageFilter.DragComplete -= new EventHandler(OnZoomRectComplete);
                parentView.RemoveDesignerMessageFilter(this.fastZoomingMessageFilter);
                this.fastZoomingMessageFilter = null;
            }

            //Update the menu
            IMenuCommandService menuCommandService = GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (menuCommandService != null)
            {
                foreach (CommandID affectedCommand in CommandSet.NavigationToolCommandIds)
                {
                    MenuCommand menuCommand = menuCommandService.FindCommand(affectedCommand);
                    if (menuCommand != null && menuCommand.Enabled)
                    {
                        menuCommand.Checked = (menuCommand.CommandID == ((this.initialState == ZoomState.In) ? WorkflowMenuCommands.ZoomIn : WorkflowMenuCommands.ZoomOut));
                    }
                }
            }
        }
コード例 #2
0
        private void RefreshUIState()
        {
            WorkflowView parentView = base.ParentView;

            if (!this.CanContinueZooming)
            {
                parentView.Cursor = ZoomDisabledCursor;
            }
            else if (this.currentState == ZoomState.In)
            {
                parentView.Cursor = ZoomInCursor;
            }
            else
            {
                parentView.Cursor = ZoomOutCursor;
            }
            if (((this.fastZoomingMessageFilter == null) && this.CanContinueZooming) && (this.currentState == ZoomState.In))
            {
                this.fastZoomingMessageFilter = new DragRectangleMessageFilter();
                this.fastZoomingMessageFilter.DragComplete += new EventHandler(this.OnZoomRectComplete);
                parentView.AddDesignerMessageFilter(this.fastZoomingMessageFilter);
            }
            else if ((this.fastZoomingMessageFilter != null) && (!this.CanContinueZooming || (this.currentState != ZoomState.In)))
            {
                this.fastZoomingMessageFilter.DragComplete -= new EventHandler(this.OnZoomRectComplete);
                parentView.RemoveDesignerMessageFilter(this.fastZoomingMessageFilter);
                this.fastZoomingMessageFilter = null;
            }
            IMenuCommandService service = base.GetService(typeof(IMenuCommandService)) as IMenuCommandService;

            if (service != null)
            {
                foreach (CommandID did in CommandSet.NavigationToolCommandIds)
                {
                    MenuCommand command = service.FindCommand(did);
                    if ((command != null) && command.Enabled)
                    {
                        command.Checked = command.CommandID == ((this.initialState == ZoomState.In) ? WorkflowMenuCommands.ZoomIn : WorkflowMenuCommands.ZoomOut);
                    }
                }
            }
        }