}// TranslateMenuCommandToString static internal void FireOffCommand(int iCommandNum) { // Our CommandNum is 100 more than the index of our item in the ArrayList ExecuteCommand((CommandHistory)m_olCommands[iCommandNum - 100], true); // When we execute this command, its "Number of times command has executed" counter // will increase automagically by 2. However, we really scored here if the user was // able to use one of our shortcut actions, so let's increase the count by an additional // 1 CommandHistory tmp = (CommandHistory)m_olCommands[iCommandNum - 100]; tmp.iNumHits++; m_olCommands[iCommandNum - 100] = tmp; }// FireOffCommand(int)
}// AgeCommands static private bool IncrementCommand(String sCommandName) { // Let's find this command in list int iLen = m_olCommands.Count; for (int i = 0; i < iLen; i++) { if (((CommandHistory)m_olCommands[i]).sCommand.Equals(sCommandName)) { CommandHistory tmp = (CommandHistory)m_olCommands[i]; tmp.iNumHits += 2; m_olCommands[i] = tmp; return(true); } } // We didn't find it return(false); }// IncrementCommand
}// FireOffCommand(int) static private bool ExecuteCommand(CommandHistory chCommand, bool fActuallyExecute) { // Ok, let's run through the nodes until we find the node we want CNode node = CNodeManager.GetNode(CNodeManager.RootNodeCookie); int iTreeLevel = chCommand.scPathToNode.Count - 1; while (node != null && iTreeLevel >= 0) { // Expand this node node = GetChild(node, chCommand.scPathToNode[iTreeLevel]); iTreeLevel--; } // Ok, now let's see if we were just trying to figure out if this command existed... if (!fActuallyExecute) { // Yes, this command will work if (node != null) { return(true); } else { return(false); } } if (node != null) { int iResultNum = GetResultNum(node, chCommand.scResultItem); // We have the node. Let's do something to it // If it was a property page, let's fire that off if (chCommand.iMenuCommand == -1) { // See if we're just opening up the node's property page if (iResultNum == -1) { node.OpenMyPropertyPage(); } else { CDO cdo = new CDO(node); // Make sure the result num is 1-based cdo.Data = iResultNum + 1; node.OpenMyResultPropertyPage(node.DisplayName, cdo); } } // It was some sort of menu command. Let's fire that off else { if (iResultNum == -1) { node.MenuCommand(chCommand.iMenuCommand); } else // This is a result item's command // Make sure we make the result number 1-based { node.MenuCommand(chCommand.iMenuCommand, iResultNum + 1); } } // Last but not least, let's go visit that node. CNodeManager.Console.SelectScopeItem(node.HScopeItem); return(true); } return(false); }// ExecuteCommand(int, bool)