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);
}
}