当前位置: 首页>>代码示例>>C#>>正文


C# Applications.CommandState类代码示例

本文整理汇总了C#中Sce.Atf.Applications.CommandState的典型用法代码示例。如果您正苦于以下问题:C# CommandState类的具体用法?C# CommandState怎么用?C# CommandState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandState类属于Sce.Atf.Applications命名空间,在下文中一共展示了CommandState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateCommand

 /// <summary>
 /// Updates command state for given command. Only called if CanDoCommand is true.</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     var camController = commandTag as CameraController;
     if (camController == null)
         return;            
     var designControl = m_designView.ActiveView;
     state.Check = designControl.CameraController.GetType() == camController.GetType();
 }
开发者ID:arsaccol,项目名称:LevelEditor,代码行数:12,代码来源:CameraCommands.cs

示例2: if

 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command state to update</param>
 void ICommandClient.UpdateCommand(object commandTag, CommandState commandState)
 {
     var historyContext = m_contextRegistry.GetActiveContext<IHistoryContext>();
     if (historyContext != null)
     {
         if (commandTag.Equals(StandardCommand.EditUndo))
         {
             commandState.Text = string.Format("Undo {0}".Localize("{0} is the name of the command"), historyContext.UndoDescription);
         }
         else if (commandTag.Equals(StandardCommand.EditRedo))
         {
             commandState.Text = string.Format("Redo {0}".Localize("{0} is the name of the command"), historyContext.RedoDescription);
         }
     }
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:19,代码来源:StandardEditHistoryCommands.cs

示例3: UpdateCommand

        /// <summary>
        /// Updates the view's commands</summary>
        /// <param name="commandTag">The command tag</param>
        /// <param name="state">State of the command</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            ISnapSettings snapSettings = (ISnapSettings)m_designView;
            IManipulator manip = commandTag as IManipulator;
            if(manip != null)
            {
                state.Check = manip == m_designView.Manipulator;
            }
            else if (commandTag is Command)
            {
                switch ((Command)commandTag)
                {
                    case Command.Select:
                        state.Check = m_designView.Manipulator == null;
                        break;

                    case Command.SnapToVertex:
                        state.Check = snapSettings.SnapVertex;
                        break;

                    case Command.RotateOnSnap:
                        state.Check = snapSettings.RotateOnSnap;
                        break;

                }
            }
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:31,代码来源:ManipulatorCommands.cs

示例4: LegacyUpdateCommand

        private void LegacyUpdateCommand(ICommandItem item)
        {
            ICommandClient client = GetClient(item.CommandTag);
            if (client == null)
                client = m_activeClient;

            if (client != null)
            {
                var commandState = new CommandState { Text = item.Text, Check = item.IsChecked };
                client.UpdateCommand(item.CommandTag, commandState);
                item.Text = commandState.Text.Trim();
                item.IsChecked = commandState.Check;
            }
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:14,代码来源:CommandService.cs

示例5: UpdateCommand

 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="commandState">Command info to update</param>
 public virtual void UpdateCommand(object commandTag, CommandState commandState)
 {
     if ((commandTag is Command))
     {
         if ((Command)commandTag == Command.Enabled && SourceControlService != null)
         {
             commandState.Text = SourceControlService.Enabled ? "Disable Source Control".Localize() : "Enable Source Control".Localize();
             m_sourceControlEnableCmd.GetButton().ToolTipText = commandState.Text;
             m_sourceControlEnableCmd.GetButton().Image = SourceControlService.Enabled ? m_sourceControlEnableImage: m_sourceControlDisableImage;
         }
     }
 }
开发者ID:sbambach,项目名称:ATF,代码行数:16,代码来源:SourceControlCommands.cs

示例6: UpdateCommand

        /// <summary>
        /// Updates command state for given command</summary>
        /// <remarks>This is used e.g. to set the check next to a menu command or 
        /// to show a toolbar button as pressed</remarks>
        /// <param name="commandTag">Command</param>
        /// <param name="commandState">Command info to update</param>
        public void UpdateCommand(object commandTag, CommandState commandState)
        {
            //GameDocument document = m_contextRegistry.GetActiveContext<GameDocument>();
            //if (document == null)
            //    return;

            //if (commandTag is Command)
            //{
            //    switch ((Command)commandTag)
            //    {
            //        case Command.ToggleSplitMode:
            //            commandState.Check = document.SplitManipulator.Active;
            //            break;
            //    }
            //}
        }
开发者ID:ldh9451,项目名称:XLE,代码行数:22,代码来源:LevelEditorCommands.cs

示例7: UpdateCommand

 /// <summary>
 /// Updates command state for given command</summary>
 /// <param name="commandTag">Command</param>
 /// <param name="state">Command state to update</param>
 public void UpdateCommand(object commandTag, CommandState state)
 {
     Control control = commandTag as Control;
     if (control != null)
     {
         string menuText = GetControlMenuText(control);
         state.Text = menuText;
         DockContent dockContent = FindContent(control);
         state.Check = dockContent.Visible && !dockContent.IsHidden
             && !IsAutoHideState(dockContent);
     }
     else if (commandTag is StandardCommand)
     {
         if ( (StandardCommand) commandTag == StandardCommand.UILock)
         {
             state.Text = UILocked ? "Unlock UI Layout".Localize() : "Lock UI Layout".Localize();
             var cmdService = m_commandService as CommandServiceBase;
             if (cmdService != null)
             {
                 string lockImgName = UILocked ? Resources.LockUIImage : Resources.UnlockUIImage;
                 if (CommandInfo.UILock.ImageName != lockImgName)
                 {
                     CommandInfo.UILock.ImageName = lockImgName;
                     cmdService.RefreshImage(CommandInfo.UILock);                            
                     CommandInfo.UILock.GetButton().ToolTipText = state.Text;
                 }
             }
         }
     }
 }
开发者ID:sbambach,项目名称:ATF,代码行数:34,代码来源:ControlHostService.cs

示例8: UpdateCommand

        /// <summary>
        /// Updates the view's commands</summary>
        /// <param name="commandTag">The command tag</param>
        /// <param name="state">State of the command</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            
            if (commandTag is Command)
            {
                switch ((Command)commandTag)
                {
                   
                    case Command.SingleView:
                        state.Check = m_designView.ViewMode == ViewModes.Single;
                        break;

                    case Command.QuadView:
                        state.Check = m_designView.ViewMode == ViewModes.Quad;
                        break;

                    case Command.DualHorizontalView:
                        state.Check = m_designView.ViewMode == ViewModes.DualHorizontal;
                        break;

                    case Command.DualVerticalView:
                        state.Check = m_designView.ViewMode == ViewModes.DualVertical;
                        break;
                }
            }
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:30,代码来源:DesignViewCommands.cs

示例9: menuItem_MouseLeave

        private void menuItem_MouseLeave(object sender, EventArgs e)
        {
            // clear status text
            if (m_statusService != null)
                m_statusService.ShowStatus(string.Empty);

            // Clear mouseover status
            m_menuMouseLocation = Point.Empty;
            m_mouseIsOverCommandIcon = null;

            var menuItem = sender as ToolStripMenuItem;
            if (menuItem != null)
            {
                object tag = menuItem.Tag;
                if ((tag != null) && (tag is IPinnable))
                {
                    CommandState commandState = new CommandState(menuItem.Text, menuItem.Checked);
                    UpdatePinnableCommand(tag, commandState);
                }
            }
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:21,代码来源:CommandService.cs

示例10: menuItem_MouseMove

        private void menuItem_MouseMove(object sender, MouseEventArgs e)
        {
            m_menuMouseLocation = e.Location;
            
            var menuItem = sender as ToolStripMenuItem;
            if (menuItem != null)
            {
                object tag = menuItem.Tag;
                if ((tag != null) && (tag is IPinnable))
                {
                    if (IsMouseOverIcon(menuItem))
                        m_mouseIsOverCommandIcon = m_commandsById[tag];
                    else
                        m_mouseIsOverCommandIcon = null;

                    CommandState commandState = new CommandState(menuItem.Text, menuItem.Checked);
                    UpdatePinnableCommand(tag, commandState);
                }
            }
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:20,代码来源:CommandService.cs

示例11: UpdateCommand

        /// <summary>
        /// Force an update on a particular command</summary>
        /// <param name="info">Command to update</param>
        public void UpdateCommand(CommandInfo info)
        {
            if (m_mainForm.InvokeRequired)
            {
                m_mainForm.BeginInvoke(new Action<CommandInfo>(UpdateCommand), info);
                return;
            }

            ToolStripMenuItem menuItem;
            ToolStripButton menuButton;
            info.GetMenuItemAndButton(out menuItem, out menuButton);

            CommandState commandState = new CommandState();
            commandState.Text = info.DisplayedMenuText;
            commandState.Check = menuItem.Checked;

            ICommandClient client = GetClient(info.CommandTag);
            if (client == null)
                client = m_activeClient;

            bool enabled = false;
            if (client != null)
            {
                enabled = client.CanDoCommand(info.CommandTag);
                if (enabled)
                    client.UpdateCommand(info.CommandTag, commandState);
            }

            string menuText = commandState.Text.Trim();

            menuItem.Text = menuButton.Text = menuText;
            menuItem.Checked = menuButton.Checked = commandState.Check;
            menuItem.Enabled = menuButton.Enabled = enabled;
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:37,代码来源:CommandService.cs

示例12: UpdateCommand

        /// <summary>
        /// Updates a command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state</param>
        public override void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is WindowLayoutServiceCommand))
                return;

            var cmd = (WindowLayoutServiceCommand)commandTag;
            state.Check = WindowLayoutService.IsCurrent(cmd.LayoutName);
        }
开发者ID:Joxx0r,项目名称:ATF,代码行数:12,代码来源:WindowLayoutServiceCommands.cs

示例13: UpdateCommand

        /// <summary>
        /// Updates command state for given command. Only called if CanDoCommand is true.</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (!(commandTag is Command))
                return;

            if (m_designView == null)
                return;

            var designControl = m_designView.ActiveView;

            switch ((Command)commandTag)
            {
                case Command.Arcball:
                    state.Check = (designControl.CameraController is ArcBallCameraController);
                    break;

                case Command.Maya:
                    state.Check = (designControl.CameraController is MayaStyleCameraController);
                    break;

                case Command.Walk:
                    state.Check = (designControl.CameraController is WalkCameraController);
                    break;

                case Command.Fly:
                    state.Check = (designControl.CameraController is FlyCameraController);
                    break;
            }
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:33,代码来源:CameraCommands.cs

示例14: UpdateCommand

        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public void UpdateCommand(object commandTag, CommandState state)
        {
            if (commandTag is CommandTag)
            {
               
                if (commandTag.Equals(CommandTag.ResetGroupPinNames))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            state.Text = string.Format("Reset Pin Names on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                else if (commandTag.Equals(CommandTag.ShowExpandedGroupPins))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            state.Check = group.Info.ShowExpandedGroupPins;
                            state.Text = string.Format("Show Expanded Group Pins on \"{0}\"".Localize(), group.Name);
                        }
                    }
                }
                else if (commandTag.Equals(CommandTag.HideUnconnectedPins))
                {
                    if (m_targetRef != null && m_targetRef.Target != null)
                    {
                        object target = m_targetRef.Target;
                        if (target.Is<Group>())
                        {
                            var group = target.Cast<Group>();
                            var graphContainer = group.ParentGraph.As<ICircuitContainer>();
                            if (graphContainer != null)
                            {
                                // check if all unconnected pins are hidden
                                m_allUnconnectedHidden = true;
                                foreach (var grpPin in group.InputGroupPins)
                                {
                                    bool externalConectd =
                                        graphContainer.Wires.FirstOrDefault(
                                            x => x.InputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                                    if (!externalConectd && grpPin.Visible)
                                    {
                                        m_allUnconnectedHidden = false;
                                        break;
                                    }
                                }
                                if (m_allUnconnectedHidden)
                                {
                                    foreach (var grpPin in group.OutputGroupPins)
                                    {
                                        bool externalConectd =
                                            graphContainer.Wires.FirstOrDefault(
                                                x => x.OutputPinTarget.FullyEquals(grpPin.PinTarget)) != null;
                                        if (!externalConectd && grpPin.Visible)
                                        {
                                            m_allUnconnectedHidden = false;
                                            break;
                                        }
                                    }
                                }

                                state.Check = m_allUnconnectedHidden;
                                state.Text = string.Format("Hide Unconnected Pins on \"{0}\"".Localize(), group.Name);
                            }
                        }
                    }
                }
            }
        }
开发者ID:vincenthamm,项目名称:ATF,代码行数:81,代码来源:GroupingCommands.cs

示例15: UpdateCommand

        /// <summary>
        /// Updates command state for given command</summary>
        /// <param name="commandTag">Command</param>
        /// <param name="state">Command state to update</param>
        public virtual void UpdateCommand(object commandTag, CommandState state)
        {
            bool invertPinImageOnMouseover = false;
            bool useGreenPin = true;
            var info = commandTag as RecentDocumentInfo;
            if (info != null)
            {
                // For the document entries in the MRU, the pin color reflects the pinned state of
                // the item. The exception is when the user mouses over the pin icon directly - then 
                // we invert the color of the pin to show that it's clickable and will modify the
                // pinned state of the document.
                invertPinImageOnMouseover = true;
                state.Text = info.Uri.LocalPath;
                if (!info.Pinned)
                {
                    useGreenPin = false;
                }
            }
            else if (commandTag is Command)
            {
                var command = (Command)commandTag;
                if (command == Command.Pin)
                {
                    // For the other pin commands, the pin color is the opposite of the active 
                    // document's pinned state.
                    var docInfo = GetActiveRecentDocumentInfo();
                    var stateText = "Pin active document".Localize();
                    if (docInfo != null)
                    {
                        useGreenPin = !docInfo.Pinned;
                        var docPath = docInfo.Uri.AbsolutePath;
                        if (MaxPathLength > 0 && docPath.Length > MaxPathLength)
                        {
                            docPath = docPath.Substring(docPath.Length - MaxPathLength);
                            while (!docPath.StartsWith("/"))
                                docPath = docPath.Substring(1);
                            docPath = "..." + docPath;
                        }
                        stateText = string.Format(
                            docInfo.Pinned ?
                                "Unpin {0}".Localize("{0} will be replaced with a file name") :
                                "Pin {0}".Localize("{0} will be replaced with a file name"),
                                docPath);
                    }
                    state.Text = stateText;
                }
                else if (command == Command.EmptyMru)
                {
                    return;
                }
            }

            var commandServiceBase = CommandService as CommandServiceBase;
            if (commandServiceBase != null)
            {
                var commandInfo = commandServiceBase.GetCommandInfo(commandTag);

                if (commandInfo != null)
                {
                    if (invertPinImageOnMouseover)
                    {
                        // Make sure user is mousing over this command.
                        if (commandServiceBase.MouseIsOverCommandIcon == commandInfo)
                        {
                            useGreenPin = !useGreenPin;
                        }
                    }

                    var imageName = useGreenPin ? Resources.PinGreenImage : Resources.PinGreyImage;
                    if (commandInfo.ImageName != imageName)
                    {
                        commandInfo.ImageName = imageName;
                        commandServiceBase.RefreshImage(commandInfo);
                    }
                }
            }
        }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:81,代码来源:RecentDocumentCommands.cs


注:本文中的Sce.Atf.Applications.CommandState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。