public override void LoadContent(ContentManager content) { backgroundImage.LoadContent(content); creditsText.LoadContent(content); menuManager.LoadContent(content); menuManager.AddMenu(menu); }
public void TestMainMenuClick() { var assertableMenuAction = new AssertableMenuAction(); var menuManager = new MenuManager(); menuManager.AddMenu(MenuLocation.MainMenu + ("menu" + assertableMenuAction.Named("action1") + assertableMenuAction.Named("action2") + MenuItem.Separator + ("sub-menu" + assertableMenuAction.Named("sub-menu-action1") + assertableMenuAction.Named("sub-menu-action2") ) + assertableMenuAction.Named("action3"))); AddInContext context = CreateMainMenuContext(); menuManager.GetMenuItems(context, null); menuManager.MenuClick(context, "-menu", "action1"); menuManager.MenuClick(context, "-menu", "action2"); menuManager.MenuClick(context, "-sub-menu", "sub-menu-action1"); menuManager.MenuClick(context, "-sub-menu", "sub-menu-action2"); menuManager.MenuClick(context, "-menu", "action3"); Assert.AreEqual(new[] { "action1", "action2", "sub-menu-action1", "sub-menu-action2", "action3" }, assertableMenuAction.ExecutedActions); }
/// <summary> /// The ActiveX control that WebBrowser uses has complex /// focus rules, we work around them by focusing the pane group /// when toggling back to the workbook/repl tab then the WebBroser.Focus () /// logic correctly handles the navigation /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void HandleSelectedPaneChanged(object sender, EventArgs args) { var group = sender as Selector; if (group != null) { switch (group.SelectedIndex) { case 0: group.Focus(); webView?.Focus(); menuManager.RemoveMenu((MenuItem)Resources ["viewMenu"]); break; case 1: group.Focus(); if (ViewModel.SelectedView == null) { ViewModel.RefreshVisualTreeAsync().Forget(); } var menuItem = (MenuItem)Resources ["viewMenu"]; if (menuItem.Parent == null) { menuManager.AddMenu(menuItem); } break; } } }
public void TestGetMainMenuItems() { var menuManager = new MenuManager { DefaultMenuItems = new[] { "default" } }; menuManager.AddMenu(MenuLocation.MainMenu + ("menu" + "action1".OnClick(DoNothing) + "action2".OnClick(DoNothing) + MenuItem.Separator + ("sub-menu" + "sub-menu-action1".OnClick(DoNothing) + "sub-menu-action2".OnClick(DoNothing) ) + "action3".OnClick(DoNothing))); var context = CreateMainMenuContext(); Assert.AreEqual(new[] { "default" }, menuManager.GetMenuItems(context, "unknown menu name")); Assert.AreEqual(new[] { "-menu" }, menuManager.GetMenuItems(context, null)); Assert.AreEqual(new[] { "-menu" }, menuManager.GetMenuItems(context, string.Empty)); Assert.AreEqual(new[] { "action1", "action2", "-", "-sub-menu", "action3" }, menuManager.GetMenuItems(context, "-menu")); Assert.AreEqual(new[] { "sub-menu-action1", "sub-menu-action2" }, menuManager.GetMenuItems(context, "-sub-menu")); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here InputController.Initialize(GraphicsDevice, Content); menus = new MenuManager(); mainMenu = new GameMenu(Content); menus.AddMenu(mainMenu); menus.SetMenu("GameMenu"); }
public void AddMenu(MenuInfo menu) { MenuEntity entity = new MenuEntity(); entity.Id = Guid.NewGuid(); entity.Index = menu.Index; entity.IsNewWindow = menu.IsNewWindow; entity.Name = menu.Name; entity.ParentId = menu.ParentId; MenuManager manager = new MenuManager(DbAccess); manager.AddMenu(entity); }
public void TestContextMenuClick() { var action = new AssertableMenuAction(); var menuManager = new MenuManager(); menuManager.AddMenu(MenuLocation.TreeView + ("VIENNAAddIn" + action.Named("Validate BDT Library") + action.Named("Create new BDT"))) .ShowIf(ContextIsBDTLibrary); var context = CreatePackageContext(Stereotype.BDTLibrary); menuManager.GetMenuItems(context, null); menuManager.MenuClick(context, "-VIENNAAddIn", "Validate BDT Library"); menuManager.MenuClick(context, "-VIENNAAddIn", "Create new BDT"); Assert.AreEqual(new[] { "Validate BDT Library", "Create new BDT" }, action.ExecutedActions); }
public void TestGetContextMenuItems() { var menuManager = new MenuManager { DefaultMenuItems = new[] { "default" } }; menuManager.AddMenu(MenuLocation.TreeView + ("VIENNAAddIn" + "Validate BDT Library".OnClick(DoNothing) + "Create new BDT".OnClick(DoNothing))) .ShowIf(context => context.SelectedItemIsLibraryOfType(Stereotype.BDTLibrary)); Assert.AreEqual(new[] { "default" }, menuManager.GetMenuItems(CreateMainMenuContext(), null)); Assert.AreEqual(new[] { "-VIENNAAddIn" }, menuManager.GetMenuItems(CreatePackageContext(Stereotype.BDTLibrary), null)); Assert.AreEqual(new[] { "Validate BDT Library", "Create new BDT" }, menuManager.GetMenuItems(CreatePackageContext(Stereotype.BDTLibrary), "-VIENNAAddIn")); Assert.AreEqual(new[] { "default" }, menuManager.GetMenuItems(CreateElementContext(), null)); Assert.AreEqual(new[] { "default" }, menuManager.GetMenuItems(CreateDiagramContext(), null)); }
public void TestGetMainMenuState() { var testPredicate = new TestPredicate(); var menuManager = new MenuManager(); menuManager.AddMenu(MenuLocation.MainMenu + ("menu" + "action1".OnClick(DoNothing).Checked(testPredicate.IsChecked).Enabled(testPredicate.IsEnabled) + "action2".OnClick(DoNothing).Checked(testPredicate.IsChecked).Enabled(testPredicate.IsEnabled) + MenuItem.Separator + ("sub-menu" + "sub-menu-action1".OnClick(DoNothing).Checked(testPredicate.IsChecked).Enabled(testPredicate.IsEnabled) + "sub-menu-action2".OnClick(DoNothing).Checked(testPredicate.IsChecked).Enabled(testPredicate.IsEnabled) ) + "action3".OnClick(DoNothing).Checked(testPredicate.IsChecked).Enabled(testPredicate.IsEnabled))); menuManager.GetMenuItems(CreateMainMenuContext(), null); AssertMenuState(testPredicate, menuManager, "-menu", "action1"); AssertMenuState(testPredicate, menuManager, "-menu", "action2"); AssertMenuState(testPredicate, menuManager, "-menu", "action3"); AssertMenuState(testPredicate, menuManager, "-sub-menu", "sub-menu-action1"); AssertMenuState(testPredicate, menuManager, "-sub-menu", "sub-menu-action2"); }
///<summary> ///</summary> public VIENNAAddIn() { menuManager = new MenuManager { DefaultMenuItems = new[] { AddInSettings.AddInName }, DefaultEnabled = IfRepositoryIsUmm2Model, DefaultChecked = Never }; MenuAction createUPCCStructure = "&Create initial UPCC3 model structure".OnClick(UpccModelCreator.ShowForm); MenuAction createABIE = "Create new &ABIE".OnClick(AbieEditor.ShowCreateDialog); MenuAction createBDT = "Create new BD&T".OnClick(BdtEditor.ShowCreateDialog); MenuItem modifyAbie = "&Modify ABIE".OnClick(AbieEditor.ShowUpdateDialog).Enabled(IfABIEIsSelected); MenuAction validate = "&Validate".OnClick(ValidatorForm.ShowValidator); MenuItem _____ = MenuItem.Separator; menuManager.AddMenu(MenuLocation.MainMenu + (AddInSettings.AddInName // + "&Set Model as UMM2/UPCC3 Model" // .OnClick(ToggleUmm2ModelState) // .Checked(IfRepositoryIsUmm2Model) // .Enabled(Always) // + createUPCCStructure // + "&Create initial UMM 2 model structure".OnClick(UmmInitialPackageStructureCreator.ShowForm) // + _____ // + "&Validate All - UPCC3".OnClick(ValidatorForm.ShowUpccValidator) // + "&Validate All - UMM2".OnClick(ValidatorForm.ShowUmmValidator) // + _____ // + ("Maintenance" // + "Synchronize &Tagged Values...".OnClick(SynchStereoTypes.ShowForm) // // TODO: revert this to reenable UML Class Customizer // //+ "Set Stereo Types...".OnClick(StereoTypeTransformer.ShowForm) // ) // + ("Wizards" // + createABIE // + modifyAbie // + createBDT // TODO: revert this to reenable UML Class Customizer //+ "&Uml Class Customizer".OnClick(UmlClassCustomizer.ShowCreateDialog) //+ "Generate &XML Schema (old)".OnClick(GeneratorWizardForm.ShowGeneratorWizard) // + "&Generate XML Schema".OnClick(ExporterForm.ShowForm) // + "&Import XML Schemas".OnClick(XsdImporterForm.ShowForm) // + "&XSLT Generator".OnClick(XsltGeneratorForm.ShowForm) // //+ "Import XML Schemas (old)".OnClick(ImporterWizardFormOld.ShowImporterWizard) // + _____ // + "&Transformer Wizard".OnClick(TransformerWizard.ShowForm) // + "&Sub&setting Wizard".OnClick(SubSettingWizard.ShowForm) // + "&Schema Anal&yzer".OnClick(SchemaAnalyzer.ShowForm) // + "&WSDL Generator".OnClick(WSDLGenerator.ShowForm) // ) // + "&Options".OnClick(OptionsForm.ShowForm) + ("&About " + AddInSettings.AddInName).OnClick(AboutWindow.ShowForm))); menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) + (AddInSettings.AddInName + "&Generate XML Schema".OnClick(ExportXSDSchemaForm.ShowForm))) .ShowIf(context => context.SelectedPackage != null); // //menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // // + (AddInSettings.AddInName // // + validate // + "Import Standard CC Libraries".OnClick(StandardLibraryImporter.ShowForm))) // .ShowIf(context => context.SelectedItemIsLibraryOfType(Stereotype.bLibrary)); // menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // + (AddInSettings.AddInName // + createABIE // + validate)) // .ShowIf(context => context.SelectedItemIsLibraryOfType(Stereotype.BIELibrary)); // menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // + (AddInSettings.AddInName // + modifyAbie)) // .ShowIf(context => context.SelectedItemIsABIE()); // menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // + (AddInSettings.AddInName // + createBDT // + validate)) // .ShowIf(context => context.SelectedItemIsLibraryOfType(Stereotype.BDTLibrary)); // menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // + (AddInSettings.AddInName // + createUPCCStructure)) // .ShowIf(context => context.SelectedItemIsRootModel()); // menuManager.AddMenu((MenuLocation.TreeView | MenuLocation.Diagram) // + (AddInSettings.AddInName // + validate)); }