//this enables and disables various menu entries based on circumstances private void MainMenu_MouseEnter(object sender, MouseEventArgs e) { LoadMRUMenu(); LoadFindMenus(); if (theNeuronArray != null && !useServers) { ThreadCount.Text = theNeuronArray.GetThreadCount().ToString(); } else { ThreadCount.Text = ""; } if (theNeuronArray != null) { Refractory.Text = theNeuronArray.GetRefractoryDelay().ToString(); } else { Refractory.Text = ""; } if (!engineIsPaused) { EnableMenuItem(MainMenu.Items, "Run", false); EnableMenuItem(MainMenu.Items, "Pause", true); } else { EnableMenuItem(MainMenu.Items, "Run", true); EnableMenuItem(MainMenu.Items, "Pause", false); } if (useServers) { var tb0 = Utils.FindByName(MainMenu, "ThreadCount"); if (tb0.Parent is UIElement ui) { ui.Visibility = Visibility.Collapsed; } tb0 = Utils.FindByName(MainMenu, "Refractory"); if (tb0.Parent is UIElement ui1) { ui1.Visibility = Visibility.Collapsed; } } else { var tb0 = Utils.FindByName(MainMenu, "ThreadCount"); if (tb0.Parent is UIElement ui) { ui.Visibility = Visibility.Visible; } tb0 = Utils.FindByName(MainMenu, "Refractory"); if (tb0.Parent is UIElement ui1) { ui1.Visibility = Visibility.Visible; } } if (theNeuronArray == null) { EnableMenuItem(MainMenu.Items, "_Save", false); EnableMenuItem(MainMenu.Items, "Save _As", false); EnableMenuItem(MainMenu.Items, "_Insert", false); EnableMenuItem(MainMenu.Items, "_Properties", false); EnableMenuItem(MainMenu.Items, "_Notes", false); } else { EnableMenuItem(MainMenu.Items, "_Save", true); EnableMenuItem(MainMenu.Items, "Save _As", true); EnableMenuItem(MainMenu.Items, "_Insert", true); EnableMenuItem(MainMenu.Items, "_Properties", true); EnableMenuItem(MainMenu.Items, "_Notes", true); } if (theNeuronArrayView.theSelection.selectedRectangles.Count == 0) { EnableMenuItem(MainMenu.Items, " Cut", false); EnableMenuItem(MainMenu.Items, " Copy", false); EnableMenuItem(MainMenu.Items, " Delete", false); EnableMenuItem(MainMenu.Items, " Move", false); EnableMenuItem(MainMenu.Items, " Clear Selection", false); } else { EnableMenuItem(MainMenu.Items, " Cut", true); EnableMenuItem(MainMenu.Items, " Copy", true); EnableMenuItem(MainMenu.Items, " Delete", true); if (arrayView.targetNeuronIndex < 0) { EnableMenuItem(MainMenu.Items, " Move", false); } else { EnableMenuItem(MainMenu.Items, " Move", true); } EnableMenuItem(MainMenu.Items, " Clear Selection", true); } if (arrayView.targetNeuronIndex < 0 || myClipBoard == null) { EnableMenuItem(MainMenu.Items, " Paste", false); } else { EnableMenuItem(MainMenu.Items, " Paste", true); } if (theNeuronArray != null && theNeuronArray.UndoPossible()) { EnableMenuItem(MainMenu.Items, " Undo", true); } else { EnableMenuItem(MainMenu.Items, " Undo", false); } if (myClipBoard == null) { EnableMenuItem(MainMenu.Items, "Save Clipboard", false); } else { EnableMenuItem(MainMenu.Items, "Save Clipboard", true); } }