BlueSky.Commands.History.CommandHistoryMenuHandler.RemoveCommand C# (CSharp) Method

RemoveCommand() public method

public RemoveCommand ( string DatasetName, UAMenuCommand Command ) : void
DatasetName string
Command BSky.Interfaces.Services.UAMenuCommand
return void
        public void RemoveCommand(string DatasetName, UAMenuCommand Command)
        {
            //Check if command already in history menu ///
            bool ExistsInHistory = false;
            int miIndex = 0;
            foreach (MenuItem mi in commandhistmenu.Items)
            {
                if (mi.Header.ToString() == Command.text)//command already in History
                {
                    ExistsInHistory = true;
                    break;
                }
                miIndex++;
            }

            // Adding command with "latest executed on top" in menu ///
            if (ExistsInHistory)
            {
                commandhistmenu.Items.RemoveAt(miIndex);
            }
        }