public void TestOne() { var menuBuilder = new MenuBuilder(); var menu = menuBuilder.GetMenu(); Assert.IsNotNull(menu); }
public void Perform(ActionExecutionContext context) { var submenuBuilder = new MenuBuilder() .RunnableOnce(); var employees = EmployeeService.GetEmployees(); foreach (var employee in employees) { var employeeId = employee.Id; submenuBuilder.Item( string.Format("{0}", employee.Name), ctx => ContinuePaymentCreation(ctx, employeeId)); } submenuBuilder.GetMenu().Run(); }
public MenuBuilderTests() { Mock<HtmlTextWriter> writer = new Mock<HtmlTextWriter>(TextWriter.Null); menu = MenuTestHelper.CreateMenu(writer.Object, null); builder = new MenuBuilder(menu); }
/// <summary> /// Initializes a new instance of the MenuBuilderEntry class. /// </summary> public MenuBuilderEntry(MenuBuilder menuBuilder) { this.menuBuilder = menuBuilder; this.level = -1; }
/// <summary> /// Initializes a new instance of the MenuBuilderEntry class. This constructor is used for /// top level and "container" menu items. /// </summary> /// <param name="position">Merge menu entry position.</param> /// <param name="text">Merge menu entry text.</param> public MenuBuilderEntry(MenuBuilder menuBuilder, int level, int position, string text) : this(menuBuilder, level, position, text, null) { }
/// <summary> /// Initializes a new instance of the MenuBuilderEntry class. This constructor is used for /// the command menu entry. /// </summary> /// <param name="position">Merge menu entry position.</param> /// <param name="text">Merge menu entry text.</param> /// <param name="command">Merge menu entry command.</param> public MenuBuilderEntry(MenuBuilder menuBuilder, int level, int position, string text, Command command) { this.menuBuilder = menuBuilder; this.level = level; this.position = position; this.text = text; this.command = command; }
public PackageTreeNodeViewModel(Object model, PackageDatabaseTreeViewModel parent, CompositionContainer container, String assetType) { this._parent = parent; this._contextMenuTopLevelItems = new ObservableCollection<MenuItemViewModel>(); this._children = new ObservableCollection<PackageTreeNodeViewModel>(); this.Model = model; var menuItemImports = container.GetExports<IMenuItem, IContextMenuItemMetaData>(); var globalCommandImports = container.GetExports<IGlobalCommand>(); var menuBuilder = new MenuBuilder(globalCommandImports); foreach (var import in menuItemImports.Where(x => x.Metadata.AssetType == assetType)) { if (import.Metadata.IsPrimary) { this.PrimaryCommand = import.Value.Command; } menuBuilder.AddItem(import.Value, import.Metadata); } foreach (var rootItem in menuBuilder.Build().Children) { MenuItemViewModel viewModel; if (rootItem is MenuSeparatorModel) { viewModel = new MenuSeparatorViewModel(); } else { viewModel = new MenuItemViewModel(this.Model, rootItem.HeaderText, rootItem.Command, rootItem.GestureText, rootItem.Children); } _contextMenuTopLevelItems.Add(viewModel); } }
void cmsMain_Opening(object sender, System.ComponentModel.CancelEventArgs e) { e.Cancel = MainThread.AreModalFormsOpen; if (e.Cancel) { MainThread.ModalForm.Activate(); return; } cmsMain.SuspendLayout(); while (_cmdMenusCount > 0) { cmsMain.Items.RemoveAt(0); _cmdMenusCount--; } _cmdMenusCount = new MenuBuilder<ContextMenuStrip>(null).BuildCommandsMenu(0, new MenuWrapper<ContextMenuStrip>(cmsMain), new EventHandler(NotifyMenuClick)); foreach (ToolStripItem tsi in cmsMain.Items) { if (tsi == mnuMediaState) continue; string text = tsi.Text; if (text.Length > 45) { tsi.Text = text.Substring(0, 45) + "..."; tsi.ToolTipText = text; } else { tsi.ToolTipText = ""; } if (tsi is OPMToolStripMenuItem && tsi.Tag != null) { switch((OPMShortcut)tsi.Tag) { case OPMShortcut.CmdToggleShuffle: (tsi as OPMToolStripMenuItem).Checked = ProTONEConfig.ShufflePlaylist; break; case OPMShortcut.CmdPlaylistEnd: (tsi as OPMToolStripMenuItem).Checked = SystemScheduler.PlaylistEventEnabled; break; case OPMShortcut.CmdLoopPlay: (tsi as OPMToolStripMenuItem).Checked = ProTONEConfig.LoopPlay; break; } if (tsi.Tag != null) { (tsi as OPMToolStripMenuItem).ShortcutKeyDisplayString = ShortcutMapper.GetShortcutString((OPMShortcut)tsi.Tag); } } } // Dummy playlist item - required to prevent initial "delayed" opening mnuPlaylistPlaceholder.DropDownItems.Add(string.Empty); mnuPlaylistPlaceholder.DropDownOpening += new EventHandler(mnuPlaylist_DropDownOpening); mnuTools.DropDownItems.Add(string.Empty); mnuTools.DropDownOpening += new EventHandler(mnuTools_DropDownOpening); volumeScale.Width = timeScale.Width = 250; cmsMain.ResumeLayout(); }
public bool OnMenuItemSelected(MenuBuilder p0, IMenuItem p1) { _action(p0, p1); return(true); }
public void get_lvl_test() { int lvl = MenuBuilder.get_lvl(); Assert.AreEqual(0, lvl); }
public void get_args_test() { int length = MenuBuilder.get_args().Length; Assert.AreEqual(0, length); }
private void m_glControl_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F5) { MenuBuilder mb = new MenuBuilder(m_puzzleTree, this.puzzleToolStripMenuItem, this.menuShowPuzzleTree_Click, this.menuPuzzle_Click); mb.BuildMenu(); UpdateNumPuzzles(mb.NumPuzzles, mb.NumTilings); } if (e.KeyCode == Keys.F6) { m_settings.SurfaceDisplay = !m_settings.SurfaceDisplay; } if (e.KeyCode == Keys.F7) { if (m_puzzle != null && m_puzzle.Config != null) { if (m_puzzle.Config.Geometry == Geometry.Spherical) { m_settings.SphericalModel = (SphericalModel)((int)(m_settings.SphericalModel + 1) % 3); } if (m_puzzle.Config.Geometry == Geometry.Hyperbolic) { m_settings.HyperbolicModel = (HModel)(((int)m_settings.HyperbolicModel + 1) % 2); } } } if (e.KeyCode == Keys.F12) { m_renderer.SaveToSvg(); } if (e.KeyCode == Keys.Escape) { TwistHandler handler = m_renderer.TwistHandler; if (handler.Solving) { handler.Solving = false; } m_renderer.TwistHandler.m_setupMoves.Reset(); m_renderer.TwistHandler.m_workingMacro.Reset(); UpdateStatus2(); } if (e.KeyCode == Keys.X) { if (ShiftDown) { m_settings.XLevels += 2; } else { m_settings.XLevels -= 2; } } if (e.KeyCode == Keys.Y) { if (ShiftDown) { m_settings.YLevels += 2; } else { m_settings.YLevels -= 2; } } if (e.KeyCode == Keys.Z) { if (ShiftDown) { m_settings.ZLevels += 2; } else { m_settings.ZLevels -= 2; } } // Slicemask if (e.KeyCode == Keys.NumPad1 || e.KeyCode == Keys.D1) { m_renderer.SliceMask |= SliceMask.SLICEMASK_1; } if (e.KeyCode == Keys.NumPad2 || e.KeyCode == Keys.D2) { m_renderer.SliceMask |= SliceMask.SLICEMASK_2; } if (e.KeyCode == Keys.NumPad3 || e.KeyCode == Keys.D3) { m_renderer.SliceMask |= SliceMask.SLICEMASK_3; } if (e.KeyCode == Keys.NumPad4 || e.KeyCode == Keys.D4) { m_renderer.SliceMask |= SliceMask.SLICEMASK_4; } if (e.KeyCode == Keys.NumPad5 || e.KeyCode == Keys.D5) { m_renderer.SliceMask |= SliceMask.SLICEMASK_5; } if (e.KeyCode == Keys.NumPad6 || e.KeyCode == Keys.D6) { m_renderer.SliceMask |= SliceMask.SLICEMASK_6; } if (e.KeyCode == Keys.NumPad7 || e.KeyCode == Keys.D7) { m_renderer.SliceMask |= SliceMask.SLICEMASK_7; } if (e.KeyCode == Keys.NumPad8 || e.KeyCode == Keys.D8) { m_renderer.SliceMask |= SliceMask.SLICEMASK_8; } if (e.KeyCode == Keys.NumPad9 || e.KeyCode == Keys.D9) { m_renderer.SliceMask |= SliceMask.SLICEMASK_9; } m_settings.ClampLevels(); m_propertyGrid.SelectedObject = m_settings; m_glControl.Invalidate(); }
public async Task Empty() { await using var tracker = new RecordingTracker(); var menu = MenuBuilder.Build(() => { }, tracker); await Verifier.Verify(menu, settings); }