public Menu(TornadoGame game) { Game = game; SelectedItem = MenuItems.NewGame; SelectedLevel = 0; State = MenuStates.Menu; Paused = false; Background = Game.Content.Load<Texture2D>(@"Graphics\Menu\cat5fade"); MenuItemTextures = new Texture2D[4]; MenuItemTextures[(int)MenuItems.Resume] = Game.Content.Load<Texture2D>(@"Graphics\Menu\resume"); MenuItemTextures[(int)MenuItems.NewGame] = Game.Content.Load<Texture2D>(@"Graphics\Menu\new"); MenuItemTextures[(int)MenuItems.LoadLevel] = Game.Content.Load<Texture2D>(@"Graphics\Menu\load"); MenuItemTextures[(int)MenuItems.Info] = Game.Content.Load<Texture2D>(@"Graphics\Menu\info"); EscTexture = Game.Content.Load<Texture2D>(@"Graphics\Menu\esc"); TitleTexture = game.Content.Load<Texture2D>(@"Graphics\Menu\title"); CursorFrame = 0; CursorTimeSinceLastFrame = 0.0f; CursorTexture = new Texture2D[4]; for (int i = 0; i < CursorTexture.Length; i++) CursorTexture[i] = Game.Content.Load<Texture2D>(@"Graphics\Menu\tornado" + (i + 1)); InfoFont = Game.Content.Load<SpriteFont>(@"Graphics\Font\CourierNew"); LevelFont = Game.Content.Load<SpriteFont>(@"Graphics\Font\CourierNew"); Music = new MusicTrack(Game.Content, 0.5f); Music.Load(0, "Music\\category5"); Music.Play(0, true); }
public MenuOption(String text, int x, int y, MenuItems type) { this.type = type; this.x = x; this.y = y; this.text = text; }
public MainWindow() : base(Gtk.WindowType.Toplevel) { oXbmc = new XBMC_Communicator(); oXbmc.SetIp("10.0.0.5"); oXbmc.SetConnectionTimeout(4000); oXbmc.SetCredentials("", ""); oXbmc.Status.StartHeartBeat(); Build (); this.AllowStaticAccess(); //Create objects used oPlaylist = new Playlist(this); oControls = new Controls(this); oMenuItems = new MenuItems(this); oContextMenu = new ContextMenu(this); oShareBrowser = new ShareBrowser(this); oTrayicon = new SysTrayIcon(this); oStatusUpdate = new StatusUpdate(this); oMediaInfo = new MediaInfo(this); oNowPlaying = new NowPlaying(this); oGuiConfig = new GuiConfig(this); nbDataContainer.CurrentPage = 0; }
public static AbstractDataEntityManager GetDataEntityManager(MenuItems menuItem) { switch (menuItem) { case MenuItems.Aree: return new AreeDataEntityManager (); default: return null; } }
private void Menu_selectedItem(MenuItems m) { switch (m) { case MenuItems.NewGame: menu.Dispose(); menu = null; StartGame(); break; case MenuItems.Quit: Application.Exit(); break; } }
//Fill menuitems public static void GetAllItems(MenuItems menu) { //select all controls that have no parent foreach(CustTreeItems cti in DAL.DAL.ExecuteDataReader("S_AllTopControls_Name", FillCustTreeItems)) { //if cti has permissions : add permissions if (cti.HasPermissions) { AddPermissionsToControl(cti); } else { //no permissions check if there are subItems InsertSubItems(cti); } //finally add the toplevel item menu.Items.Add(cti); } }
/// <summary> /// Passes some global variables to the template engine and renders the previously specified view. /// </summary> /// <param name="activeMenuItem">The page to be shown as "active" in the menu.</param> /// <param name="model">The model being shown/edited in this view.</param> protected async Task <IActionResult> RenderViewAsync(MenuItems activeMenuItem = MenuItems.Undefined, object model = null) { // Pass current user var currentUser = await GetCurrentUserAsync(); ViewData["CurrentUser"] = currentUser; // Pass active menu item ViewData["ActiveMenuItem"] = activeMenuItem; // Page title // Request service manually, to avoid injecting too many services in constructors of derived classes var configService = HttpContext.RequestServices.GetService <IConfigurationService>() ?? throw new Exception("Could not retrieve configuration service."); ViewData["PageTitle"] = await configService.GetPageTitleAsync(HttpContext.RequestAborted); ViewData["NavbarTitle"] = await configService.GetNavbarTitleAsync(HttpContext.RequestAborted); // Other render data ViewData["BuildVersion"] = _buildVersion; // Render view return(RenderView(model)); }
private void ShowItemsByName() { Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Please enter the Name of the item you wish to see: "); Console.ForegroundColor = ConsoleColor.Green; string mealName = Console.ReadLine(); MenuItems content = _menuItemsRepo.GetItemsByName(mealName); if (content != null) { DisplaySimple(content); } else { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("There are no menu items that match that name.\n" + "Please try again..."); } Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Press any key to continue..."); Console.ReadKey(); Console.ResetColor(); }
private void Selected_Click(object sender, RoutedEventArgs e) { selected = 0; foreach (Button buttons in ListBoxMenu.Items) { if (buttons.Equals((sender as Button))) { break; } selected++; } if (selected > 0) { selectedMenuItem = StorageData.MenuItemsList.ElementAt(selected - 1); ButtonEdit.Visibility = Visibility.Visible; ButtonRemove.Visibility = Visibility.Visible; } else { Grid ParentGrid = (Grid)this.Parent; ParentGrid.Children.Add(new MenuNew(_client)); ParentGrid.Children.RemoveAt(ParentGrid.Children.Count - 2); } }
public override void OnApplicationStart() { base.OnApplicationStart(); Id = "screencapture"; // create menu item and use OnExecute/OnExecuteConfiguration/OnCanExecute handlers var menuItem = new AddInMenuItem(this) { Caption = "Screen Capture", FontawesomeIcon = FontAwesomeIcon.Camera, KeyboardShortcut = ScreenCaptureConfiguration.Current.KeyboardShortcut }; MenuItems.Add(menuItem); try { menuItem.IconImageSource = new ImageSourceConverter() .ConvertFromString("pack://application:,,,/ScreenCaptureAddin;component/icon_22.png") as ImageSource; } catch { } }
private void MenuItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { Vector2 minSize = new Vector2(LocalBounds.Width, LocalBounds.Height); string startText = mainControlText.Text; foreach (MenuItem item in MenuItems.ToList()) { mainControlText.Text = item.Text; minSize.x = Math.Max(minSize.x, LocalBounds.Width); minSize.y = Math.Max(minSize.y, LocalBounds.Height); } mainControlText.Text = startText; this.MinimumSize = minSize; foreach (MenuItem item in e.NewItems) { item.MinimumSize = minSize; } } }
public override void OnDraw(SpriteBatch spriteBatch, Vec2 cameraOrigin, Vector2 viewport) { var maxWidth = GetMaxWidth(); var totalHeight = GetTotalHeight(); var startY = ((viewport.Y / 2) - (totalHeight / 2)); for (var i = 0; i < MessageTextures.Count(); ++i) { var item = MessageTextures[i]; // align x to the center of the widest menu item var startX = (((viewport.X / 2) - (maxWidth / 2)) + ((maxWidth / 2) - (item.Width / 2))); var origin = new Vector2(startX, startY); spriteBatch.Draw(item, origin); startY += item.Height + MenuDefinition.SpaceBetweenMessages; } for (var i = 0; i < MenuItems.Count(); ++i) { var item = MenuItems[i]; // align x to the center of the widest menu item var startX = (((viewport.X / 2) - (maxWidth / 2)) + ((maxWidth / 2) - (item.Texture.Width / 2))); var origin = new Vector2(startX, startY); item.Draw(spriteBatch, origin); startY += item.Texture.Height + MenuDefinition.SpaceBetweenMenuItems; } var selectedItem = MenuItems[SelectedIndex]; var position = selectedItem.Position; position.X -= (SelectTexture.Width + 100); spriteBatch.Draw(SelectTexture, position); }
public void AddItem(string name, string value = null, double pointSize = 12) { if (value == null) { value = name; } mainControlText.Margin = MenuItemsPadding; GuiWidget normalTextWithMargin = new GuiWidget(); normalTextWithMargin.HAnchor = HAnchor.FitToChildren; normalTextWithMargin.BackgroundColor = MenuItemsBackgroundColor; TextWidget normal = new TextWidget(name, pointSize: pointSize); normal.Margin = MenuItemsPadding; normal.TextColor = MenuItemsTextColor; normalTextWithMargin.AddChild(normal); normalTextWithMargin.VAnchor = VAnchor.FitToChildren; GuiWidget hoverTextWithMargin = new GuiWidget(); hoverTextWithMargin.HAnchor = HAnchor.FitToChildren; hoverTextWithMargin.BackgroundColor = MenuItemsBackgroundHoverColor; TextWidget hover = new TextWidget(name, pointSize: pointSize); hover.Margin = MenuItemsPadding; hover.TextColor = mainControlText.TextColor; hoverTextWithMargin.AddChild(hover); hoverTextWithMargin.VAnchor = VAnchor.FitToChildren; MenuItem menuItem = new MenuItem(new MenuItemStatesView(normalTextWithMargin, hoverTextWithMargin), value); menuItem.Text = name; MenuItems.Add(menuItem); }
public virtual void MergeMenu(Menu menuSrc) { int i, j; MenuItem item; MenuItem itemDst; if (menuSrc == this) { throw new ArgumentException(SR.MenuMergeWithSelf, "menuSrc"); } if (menuSrc.items != null && items == null) { MenuItems.Clear(); } for (i = 0; i < menuSrc.ItemCount; i++) { item = menuSrc.items[i]; switch (item.MergeType) { default: continue; case MenuMerge.Add: MenuItems.Add(FindMergePosition(item.MergeOrder), item.MergeMenu()); continue; case MenuMerge.Replace: case MenuMerge.MergeItems: break; } int mergeOrder = item.MergeOrder; // Can we find a menu item with a matching merge order? // Use new method to find the approximate merge position. The original // method assumed (incorrectly) that the MergeOrder of the target menu would be sequential // as it's guaranteed to be in the MDI imlementation of merging container and child // menus. However, user code can call MergeMenu independently on a source and target // menu whose MergeOrder values are not necessarily pre-sorted. for (j = xFindMergePosition(mergeOrder); ; j++) { if (j >= ItemCount) { // A matching merge position could not be found, // so simply append this menu item to the end. MenuItems.Add(j, item.MergeMenu()); break; } itemDst = items[j]; if (itemDst.MergeOrder != mergeOrder) { MenuItems.Add(j, item.MergeMenu()); break; } if (itemDst.MergeType != MenuMerge.Add) { if (item.MergeType != MenuMerge.MergeItems || itemDst.MergeType != MenuMerge.MergeItems) { itemDst.Dispose(); MenuItems.Add(j, item.MergeMenu()); } else { itemDst.MergeMenu(item); } break; } } } }
private void updateHeaderVisibility() => Header.Alpha = MenuItems.Any(i => i.IsPresent) ? 1 : 0;
private void initMenus() { double width = 16; double height = 16; var add = BitmapImageHelper.GetImage(@"pack://*****:*****@"pack://application:,,,/Desktop.Resource;component/Images/Edit_32.png"); edit.Width = width; edit.Height = height; MenuItems.Add(new MenuItem() { Icon = edit, Header = ResourceHelper.FindResource("Edit"), Command = EditCommand }); var delete = BitmapImageHelper.GetImage(@"pack://*****:*****@"pack://application:,,,/Desktop.Resource;component/Images/Refresh_32.png"); refresh.Width = width; refresh.Height = height; MenuItems.Add(new MenuItem() { Icon = refresh, Header = ResourceHelper.FindResource("Refresh"), Command = RefreshCommand }); var import = BitmapImageHelper.GetImage(@"pack://*****:*****@"pack://application:,,,/Desktop.Resource;component/Images/Export_32.png"); export.Width = width; export.Height = height; MenuItems.Add(new MenuItem() { Icon = export, Header = ResourceHelper.FindResource("Export"), Command = ExportCommand }); var print = BitmapImageHelper.GetImage(@"pack://application:,,,/Desktop.Resource;component/Images/Print_32.png"); print.Width = width; print.Height = height; MenuItems.Add(new MenuItem() { Icon = print, Header = ResourceHelper.FindResource("Print"), Command = PrintCommand }); }
public void InsertSingleEntry(int index, ToolStripItem tsi) { MenuItems.Insert(index, tsi); }
public void AddSingleEntry(ToolStripItem tsi) { MenuItems.Add(tsi); }
public void ShowMenu(MenuItems item) { //set colors in menu Console.Clear(); Console.ForegroundColor = ConsoleColor.Blue; Console.BackgroundColor = ConsoleColor.White; switch (item) { case MenuItems.Main: Console.WriteLine("Main Menu"); Console.WriteLine("N=New Member\t K=Compact List\t L=Verbose List\t Q=Quit"); break; case MenuItems.Members: Console.WriteLine("Members"); Console.WriteLine("S=Select\t H=Main Menu"); break; case MenuItems.Member: Console.WriteLine("Member"); Console.WriteLine("D=Delete Member C=Change Member J=Add Boat R=Delete Boat E=Change Boat H=Main Menu"); break; } Console.ResetColor(); }
private void _keyboardHook_KeyUp(object sender, KeyEventArgs e) { //base.OnKeyUp(e); if (e.KeyCode == Keys.Down) { RibbonItem NextItem = null; RibbonItem SelectedItem = null; foreach (RibbonItem itm in MenuItems) { if (itm.Selected) { SelectedItem = itm; break; } } if (SelectedItem != null) { //get the next item in the chain int Index = MenuItems.IndexOf(SelectedItem); NextItem = GetNextSelectableMenuItem(Index + 1); } else { //nothing found so lets search through the recent buttons foreach (RibbonItem itm in RecentItems) { if (itm.Selected) { SelectedItem = itm; itm.SetSelected(false); itm.RedrawItem(); break; } } if (SelectedItem != null) { //get the next item in the chain int Index = RecentItems.IndexOf(SelectedItem); NextItem = GetNextSelectableRecentItem(Index + 1); } else { //nothing found so lets search through the option buttons foreach (RibbonItem itm in OptionItems) { if (itm.Selected) { SelectedItem = itm; itm.SetSelected(false); itm.RedrawItem(); break; } } if (SelectedItem != null) { //get the next item in the chain int Index = OptionItems.IndexOf(SelectedItem); NextItem = GetNextSelectableOptionItem(Index + 1); } } } //last check to make sure we found a selected item if (SelectedItem == null) { //we should have the right item by now so lets select it NextItem = GetNextSelectableMenuItem(0); if (NextItem != null) { NextItem.SetSelected(true); NextItem.RedrawItem(); } } else { SelectedItem.SetSelected(false); SelectedItem.RedrawItem(); NextItem.SetSelected(true); NextItem.RedrawItem(); } //_sensor.SelectedItem = NextItem; //_sensor.HittedItem = NextItem; } else if (e.KeyCode == Keys.Up) { } }
public void BuildMenu(MenuItems menuItems) { _page.SetMenuItems(menuItems); }
private float CalculateSalary() { return(MenuItems.Sum(m => m.Quantity * m.MenuItem.Price.Amount)); }
private NavigationViewItem Find(string content) => MenuItems.OfType <NavigationViewItem>().SingleOrDefault(x => x.Content.Equals(content));
private string GetImageLocation(MenuItems mi) { switch (mi) { case MenuItems.MenuBar: return @"Images\menu_bar.9.png"; case MenuItems.ContentBackground: return @"Images\dialogbackground.9.png"; case MenuItems.Button: return @"Images\button.9.png"; case MenuItems.ButtonPressed: return @"Images\button_pressed.9.png"; case MenuItems.SideButton: return @"Images\sidebtnnormal.9.png"; case MenuItems.SideButtonPressed: return @"Images\sidebtnpressed.9.png"; case MenuItems.TopButton: return @"Images\top_tab_unpressed.9.png"; case MenuItems.TopButtonPressed: return @"Images\top_tab_pressed.9.png"; case MenuItems.Transparent: return @"Images\transparent.9.png"; default: return ""; } }
protected void OnClick(object sender, System.EventArgs e) { MruMenuItem menuItem = (MruMenuItem)sender; clickedHandler(MenuItems.IndexOf(menuItem) - StartIndex, menuItem.Filename); }
//SELECT METHODS public static MenuItems GetTreeMenu() { MenuItems mu = new MenuItems(); List<MenuItem> dbmi = new List<MenuItem>(); Queue<Tuple<string,CustTreeItems>> toAddParent = new Queue<Tuple<string,CustTreeItems>>(); dbmi.AddRange(DAL.DAL.ExecuteDataReader("S_AllControls_ControlName_PermissionName", FillMenuItem)); List<CustTreeItems> menulist = new List<CustTreeItems>(); Dictionary<string, CustTreeItems> itemsDictionary = new Dictionary<string, CustTreeItems>(); Dictionary<string, CustTreeItems> addPermissions = new Dictionary<string, CustTreeItems>(); foreach(var t in dbmi) { CustTreeItems c; if (!itemsDictionary.ContainsKey(t.Name)) { c = new CustTreeItems(); c.Name = t.Name; c.HasAccess = false; } else { c = itemsDictionary[t.Name]; } if (!string.IsNullOrEmpty(t.PermissionName)) { c.HasPermissions = true; c.Options.Add(new Permission(c, t.PermissionName, t.PermissionDescription, false)); } if (!string.IsNullOrEmpty(t.ParentName)) { c.HasParent = true; if (itemsDictionary.ContainsKey(t.ParentName)) { CustTreeItems parent = itemsDictionary[t.ParentName]; c.Parent = parent; int count = parent.Items.Where(x => x.Name == c.Name).Count(); if(count == 0) parent.Items.Add(c); itemsDictionary.TryAdd(t.Name, c); } else { toAddParent.Enqueue(Tuple.Create(t.ParentName,c)); } } else { itemsDictionary.TryAdd(t.Name, c); } itemsDictionary.TryAdd(t.Name, c); } //niet zo efficient maar mijn vermoedelijke efficientere manier liet het afweten //als parent in itemsdictionary -> bind //als parent niet in itemsdicionary -> enqueue en voer op het einde uit //in het beste scenario staat alles op volgorde, in het slechtste staat mijn parent steeds op het einde while(toAddParent.Count > 0) { Tuple<string, CustTreeItems> it = toAddParent.Dequeue(); CustTreeItems child = it.Item2; if (itemsDictionary.ContainsKey(it.Item1)) { CustTreeItems parent = itemsDictionary[it.Item1]; child.Parent = parent; int count = parent.Items.Where(x => x.Name == child.Name).Count(); if (count == 0) parent.Items.Add(child); itemsDictionary.TryAdd(it.Item1, child); } else { toAddParent.Enqueue(it); } } //foreach(MenuItem menuitem in dbmi) //{ // CustTreeItems cti; // if (itemsDictionary.ContainsKey(menuitem.Name)) // { // cti = itemsDictionary[menuitem.Name] ?? new CustTreeItems(menuitem.Name); // } // else // { // cti = new CustTreeItems(menuitem.Name); // } // cti.HasAccess = false; // if (!string.IsNullOrEmpty(menuitem.PermissionName)) // { // cti.HasPermissions = true; // cti.Options.Add(new Permission(cti, menuitem.PermissionName, menuitem.PermissionDescription, false)); // } // if (cti.HasParent = !string.IsNullOrEmpty(menuitem.ParentName)) // { // CustTreeItems parent; // if (itemsDictionary.TryGetValue(menuitem.ParentName, out parent)) // { // parent.Items.Add(cti); // cti.Parent = parent; // } // else // { // toAddParent.Add( Tuple.Create(menuitem.ParentName, cti) ); // } // } // foreach(var tuple in toAddParent) // { // if(tuple.Item1 == menuitem.Name) // { // CustTreeItems child = tuple.Item2; // child.Parent = cti; // cti.Items.Add(child); // break; // } // } // itemsDictionary.TryAdd(menuitem.Name, cti); //} ////itemsDictionary.Values.Where(treeitem => !treeitem.HasParent).ToList().ForEach(x => mu.Items.Add(x)); foreach (var v in itemsDictionary) { if (!v.Value.HasParent) { mu.Items.Add(v.Value); } } return mu; }
public DeathWindow() : base("Death Window") { // Add the menu items MenuItems.Add("Respawn", new Button(new Vector2(640, 500), "Respawn", RespawnPlayer)); MenuItems.Add("Main Menu", new Button(new Vector2(640, 700), "Main Menu", BackToMain)); }
public void Arrange() { _repo = new MenuItemsRepository(); _content = new MenuItems(5, "Meat Lover's Delight", "Ham sausage bacon egg cheese sandwich", "1, 2, 3", 3.95f); _repo.AddItemToMenu(_content); }
public SplineContextMenu() : base() { MenuItem Import = new MenuItem("Import"); Import.Click += (sender, args) => { if (MainForm.SelectedDataNode.Accessor is HSD_Spline spline) { var f = Tools.FileIO.OpenFile("Spline CSV(*.csv)|*.csv"); using (FileStream stream = new FileStream(f, FileMode.Open)) using (StreamReader s = new StreamReader(stream)) { List <HSD_Vector3> points = new List <HSD_Vector3>(); int line_index = 0; float totalLength = 0; while (!s.EndOfStream) { var line = s.ReadLine(); var ar = line.Split(','); if (ar.Length < 3 || ar.Length >= 4) { MessageBox.Show( $"Unexpected argument count on line {line_index}", "Error Reading File", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (float.TryParse(ar[0], out float x) && float.TryParse(ar[1], out float y) && float.TryParse(ar[2], out float z) ) { points.Add(new HSD_Vector3() { X = x, Y = y, Z = z }); totalLength += new Vector3(x, y, z).Length; } else { MessageBox.Show( $"Unexpected value in {line} on line {line_index}", "Error Reading File", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } line_index++; } float[] lengths = new float[points.Count]; for (int i = 0; i < points.Count; i++) { lengths[i] = i / (float)(points.Count - 1); } spline.TotalLength = totalLength; spline.Points = points.ToArray(); spline.Lengths = new HSDRaw.HSDFloatArray() { Array = lengths }; } } }; MenuItems.Add(Import); MenuItem Export = new MenuItem("Export"); Export.Click += (sender, args) => { if (MainForm.SelectedDataNode.Accessor is HSD_Spline spline) { var f = Tools.FileIO.SaveFile("Spline CSV(*.csv)|*.csv"); if (f != null) { using (FileStream stream = new FileStream(f, FileMode.Create)) using (StreamWriter s = new StreamWriter(stream)) { var points = spline.Points; foreach (var p in points) { s.WriteLine($"{p.X},{p.Y},{p.Z}"); } } } } }; MenuItems.Add(Export); }
public void AddMenuItem(MenuItem menuItem) { MenuItems.Add(menuItem); }
public TornadoGame.GameState Update(float elapsedMilliseconds) { if (State == MenuStates.Menu) { // change selected item if up or down pressed if (Input.KeysHit.Contains(Keys.Up)) SelectedItem--; if (Input.KeysHit.Contains(Keys.Down)) SelectedItem++; if (Paused) { if (SelectedItem > MenuItems.Info) SelectedItem = MenuItems.Resume; if (SelectedItem < MenuItems.Resume) SelectedItem = MenuItems.Info; } else { if (SelectedItem > MenuItems.Info) SelectedItem = MenuItems.NewGame; if (SelectedItem < MenuItems.NewGame) SelectedItem = MenuItems.Info; } // test for selection choice if (Input.KeysHit.Contains(Keys.Enter)) { if (SelectedItem == MenuItems.Resume) { Paused = false; return TornadoGame.GameState.InGame; } else if (SelectedItem == MenuItems.NewGame) { Game.LevelIndex = 0; return TornadoGame.GameState.NewGame; } else if (SelectedItem == MenuItems.LoadLevel) { State = MenuStates.LoadLevel; LevelConfigs = XmlSettingsFile.LevelConfigs; } else if (SelectedItem == MenuItems.Info) State = MenuStates.Info; } if (Input.KeysHit.Contains(Keys.F1)) { Game.CreditsY = Game.WindowHeight; return TornadoGame.GameState.Complete; } if (Input.KeysHit.Contains(Keys.Escape)) return TornadoGame.GameState.Quit; } else if (State == MenuStates.LoadLevel) { if (Input.KeysHit.Contains(Keys.Escape)) State = MenuStates.Menu; // change selected item if up or down pressed if (Input.KeysHit.Contains(Keys.Up)) SelectedLevel--; if (Input.KeysHit.Contains(Keys.Down)) SelectedLevel++; if (SelectedLevel > LevelConfigs.Count - 1) SelectedLevel = 0; if (SelectedLevel < 0) SelectedLevel = LevelConfigs.Count - 1; // test for selection choice if (Input.KeysHit.Contains(Keys.Enter)) { Game.LevelIndex = SelectedLevel; State = MenuStates.Menu; return TornadoGame.GameState.NewGame; } } else if (State == MenuStates.Info) { if (Input.KeysHit.Contains(Keys.Escape)) State = MenuStates.Menu; } CursorTimeSinceLastFrame += elapsedMilliseconds; return Game.State; }
protected override void Enable() { MenuItems.Remove(recentFileMenuItem); }
public ModuleDefinitionTreeViewContextMenu() { MenuItems.Add(new MenuItem { Header = "Inject assembly reference", IconFile = "injectassemblyreference.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.AssemblyReference)) }); MenuItems.Add(new MenuItem { Header = "Inject class", IconFile = "injectclass.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.Class)) }); MenuItems.Add(new MenuItem { Header = "Inject enum", IconFile = "injectenum.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.Enum)) }); MenuItems.Add(new MenuItem { Header = "Inject interface", IconFile = "injectinterface.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.Interface)) }); MenuItems.Add(new MenuItem { Header = "Inject struct", IconFile = "injectstruct.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.Struct)) }); MenuItems.Add(new MenuItem { Header = "Inject resource", IconFile = "injectresource.png", Command = new DelegateCommand(() => JustDecompilePackage.Inject(InjectType.Resource)) }); MenuItems.Add(new MenuSeparator()); MenuItems.Add(new MenuItem { Header = "Reload Reflexil object model", IconFile = "reload.png", Command = new DelegateCommand(() => JustDecompilePackage.ReloadAssembly(this, EventArgs.Empty)) }); MenuItems.Add(new MenuItem { Header = "Update JustDecompile object model", IconFile = "reload.png", Command = new DelegateCommand(() => JustDecompilePackage.UpdateHostObjectModel(this, EventArgs.Empty)) }); MenuItems.Add(new MenuSeparator()); MenuItems.Add(new MenuItem { Header = "Obfuscator search...", IconFile = "obfuscator.png", Command = new DelegateCommand(() => JustDecompilePackage.SearchObfuscator(this, EventArgs.Empty)) }); MenuItems.Add(new MenuItem { Header = "Rename...", IconFile = "rename.png", Command = new DelegateCommand(() => JustDecompilePackage.RenameItem(this, EventArgs.Empty)) }); MenuItems.Add(new MenuItem { Header = "Save as...", IconFile = "saveas.png", Command = new DelegateCommand(() => JustDecompilePackage.SaveAssembly(this, EventArgs.Empty)) }); MenuItems.Add(new MenuItem { Header = "Verify", IconFile = "verify.png", Command = new DelegateCommand(() => JustDecompilePackage.VerifyAssembly(this, EventArgs.Empty)) }); }
private NavigationViewItem FindStart() => MenuItems.OfType <NavigationViewItem>().SingleOrDefault(x => (bool)x.GetValue(NavProperties.IsStartPageProperty));
private void PopulateWindowMenu() { if (mdilist) { if (mdilist_items == null) { mdilist_items = new Hashtable(); mdilist_forms = new Hashtable(); } do { MainMenu main = GetMainMenu(); if (main == null || main.GetForm() == null) { break; } Form form = main.GetForm(); mdicontainer = form.MdiContainer; if (mdicontainer == null) { break; } // Remove closed forms MenuItem[] items = new MenuItem[mdilist_items.Count]; mdilist_items.Keys.CopyTo(items, 0); foreach (MenuItem item in items) { Form mdichild = (Form)mdilist_items [item]; if (!mdicontainer.mdi_child_list.Contains(mdichild)) { mdilist_items.Remove(item); mdilist_forms.Remove(mdichild); MenuItems.Remove(item); } } // Add new forms and update state for existing forms. for (int i = 0; i < mdicontainer.mdi_child_list.Count; i++) { Form mdichild = (Form)mdicontainer.mdi_child_list[i]; MenuItem item; if (mdilist_forms.Contains(mdichild)) { item = (MenuItem)mdilist_forms [mdichild]; } else { item = new MenuItem(); item.is_window_menu_item = true; item.Click += new EventHandler(MdiWindowClickHandler); mdilist_items [item] = mdichild; mdilist_forms [mdichild] = item; MenuItems.AddNoEvents(item); } item.Visible = mdichild.Visible; item.Text = "&" + (i + 1).ToString() + " " + mdichild.Text; item.Checked = form.ActiveMdiChild == mdichild; } } while (false); } else { // Remove all forms if (mdilist_items != null) { foreach (MenuItem item in mdilist_items.Values) { MenuItems.Remove(item); } mdilist_forms.Clear(); mdilist_items.Clear(); } } }
private NavigationViewItem Find(Type type) => MenuItems.OfType <NavigationViewItem>().SingleOrDefault(x => type.Equals(x.GetValue(NavProperties.PageTypeProperty)));
private void InitMenuItems() { MenuItems.Add(new MenuItem { Title = "My downloads", Icon = "download", MenuItemType = MenuItemType.MyDownloads, IsEnabled = false, Separator = true }); MenuItems.Add(new MenuItem { Title = "My list", Icon = "check", MenuItemType = MenuItemType.List, IsEnabled = false, Separator = true }); MenuItems.Add(new MenuItem { Title = "Home", MenuItemType = MenuItemType.Home, ViewModelType = typeof(HomeViewModel), IsEnabled = true }); MenuItems.Add(new MenuItem { Title = "Available for download", MenuItemType = MenuItemType.AvailableDownload, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Netflix", MenuItemType = MenuItemType.Netflix, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "TV Shows", MenuItemType = MenuItemType.TVShow, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Action", MenuItemType = MenuItemType.Action, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Anime", MenuItemType = MenuItemType.Anime, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Science Fiction", MenuItemType = MenuItemType.ScienceFiction, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Classics", MenuItemType = MenuItemType.Classic, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Comedy", MenuItemType = MenuItemType.Comedy, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Documentals", MenuItemType = MenuItemType.Documental, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Dramas", MenuItemType = MenuItemType.Drama, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Independients", MenuItemType = MenuItemType.Independient, IsEnabled = false, Separator = true }); MenuItems.Add(new MenuItem { Title = "Settings", MenuItemType = MenuItemType.Settings, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Account", MenuItemType = MenuItemType.Account, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "About", MenuItemType = MenuItemType.About, IsEnabled = false }); MenuItems.Add(new MenuItem { Title = "Close session", MenuItemType = MenuItemType.Close, IsEnabled = false }); }
public void SetMenuItems(MenuItems menuItems) { }
private void OnLoaded() { _navigationService = _regionManager.Regions[Regions.Main].NavigationService; _navigationService.Navigated += OnNavigated; SelectedMenuItem = MenuItems.First(); }
/// <summary> /// Чтение данных из бд /// </summary> private static void ReadBD() { //выборка данных из бд Models.ModelOfBar bar = new Models.ModelOfBar(); Models.ModelOfMenuItems items = new Models.ModelOfMenuItems(); Models.ModelOfUserRate rate = new Models.ModelOfUserRate(); string connectionString = "Server=localhost;Port=5432;User ID=postgres;Password=3400430;Database=Menu;"; NpgsqlConnection npgSqlConnection = new NpgsqlConnection(connectionString); npgSqlConnection.Open(); Console.WriteLine("Соединение с БД открыто"); NpgsqlCommand npgSqlCommand = new NpgsqlCommand("SELECT * FROM barinfo", npgSqlConnection); NpgsqlDataReader npgSqlDataReader = npgSqlCommand.ExecuteReader(); if (npgSqlDataReader.HasRows) { Console.WriteLine("Таблица: BarInfo"); Console.WriteLine(""); foreach (DbDataRecord dbDataRecord in npgSqlDataReader) { bar = new Models.ModelOfBar(); //Console.WriteLine(dbDataRecord["BarName"] + " " + dbDataRecord["Latitude"] + " " + dbDataRecord["Longitude"] + " " + dbDataRecord["Phone"] + " " + dbDataRecord["WorkTime"] + " " + dbDataRecord["Pictures"]); bar.BarName = dbDataRecord["BarName"].ToString(); bar.Lat = Convert.ToDouble(dbDataRecord["Latitude"]); bar.Lng = Convert.ToDouble(dbDataRecord["Longitude"]); bar.Phone = dbDataRecord["Phone"].ToString(); bar.WorkTime = dbDataRecord["WorkTime"].ToString(); bar.HasMenu = Convert.ToBoolean(dbDataRecord["HasMenu"]); string[] temp = dbDataRecord["Pictures"].ToString().Split("|"); foreach (var item in temp) { if (item != "") { bar.PictureLinks.Add(item); } } BarInfo.Add(bar); } } else { Console.WriteLine("Запрос не вернул строк в BarInfo"); } npgSqlDataReader.Close(); npgSqlCommand = new NpgsqlCommand("SELECT * FROM menuitems", npgSqlConnection); npgSqlDataReader = npgSqlCommand.ExecuteReader(); if (npgSqlDataReader.HasRows) { Console.WriteLine("Таблица: MenuItems"); Console.WriteLine(""); foreach (DbDataRecord dbDataRecord in npgSqlDataReader) { items = new Models.ModelOfMenuItems(); // Console.WriteLine(dbDataRecord["Title"] + " " + dbDataRecord["Subtitle"] + " " + dbDataRecord["Subtitle_2"] + " " + dbDataRecord["Dish"] + " " + dbDataRecord["Price"] + " " + dbDataRecord["BarName"]); items.Title = dbDataRecord["Title"].ToString(); items.Subtitle = dbDataRecord["Subtitle"].ToString(); items.Subtitle_2 = dbDataRecord["Subtitle_2"].ToString(); items.Dish = dbDataRecord["Dish"].ToString(); items.Price = Convert.ToInt32(dbDataRecord["Price"]); items.BarName = dbDataRecord["BarName"].ToString(); MenuItems.Add(items); } } else { Console.WriteLine("Запрос не вернул строк в MenuItems"); } npgSqlDataReader.Close(); npgSqlCommand = new NpgsqlCommand("SELECT * FROM UserRate", npgSqlConnection); npgSqlDataReader = npgSqlCommand.ExecuteReader(); if (npgSqlDataReader.HasRows) { Console.WriteLine("Таблица: UserRate"); Console.WriteLine(""); foreach (DbDataRecord dbDataRecord in npgSqlDataReader) { rate = new Models.ModelOfUserRate(); // Console.WriteLine(dbDataRecord["Title"] + " " + dbDataRecord["Subtitle"] + " " + dbDataRecord["Subtitle_2"] + " " + dbDataRecord["Dish"] + " " + dbDataRecord["Price"] + " " + dbDataRecord["BarName"]); rate.BarName = dbDataRecord["BarName"].ToString(); string[] temp = dbDataRecord["Likes"].ToString().Split(","); foreach (var item in temp) { if (item != "") { rate.Likes.Add(Convert.ToInt64(item)); } } temp = dbDataRecord["Dislikes"].ToString().Split(","); foreach (var item in temp) { if (item != "") { rate.Dislikes.Add(Convert.ToInt64(item)); } } UserRate.Add(rate); } } else { Console.WriteLine("Запрос не вернул строк в MenuItems"); } Console.WriteLine("чтение завершено"); npgSqlDataReader.Close(); npgSqlConnection.Close(); }
protected void UpdateMenuItems() { if (_forceTitle) { menuItems = MenuItems.Chapter | MenuItems.Audio | MenuItems.Subtitle; return; } if (menuState == MenuState.Root) { menuItems = MenuItems.None; return; } if (menuState == MenuState.PopUp) { menuItems = MenuItems.All; return; } if (chapters != null && _currentTitle != BLURAY_TITLE_FIRST_PLAY && _currentTitle != BLURAY_TITLE_TOP_MENU) if (_bPopupMenuAvailable) menuItems = MenuItems.All; else menuItems = MenuItems.Audio | MenuItems.Chapter | MenuItems.MainMenu | MenuItems.Subtitle; else menuItems = MenuItems.MainMenu; }
public string RunMenu() { var done = true; string input; do { done = false; PrintMenu(); input = Console.ReadLine().ToUpper().Trim(); // shall we exit from this menu if (input == GoBackItem.Shortcut) { break; // jump out of the loop } if (DisplayQuitToMainMenu && input == QuitToMainItem.Shortcut) { break; // jump out of the loop } MenuItem item = null; item = string.IsNullOrWhiteSpace(input) ? MenuItems.FirstOrDefault(m => m.IsDefaultChoice == true) : MenuItems.FirstOrDefault(m => m.Shortcut == input); if (item == null) { Console.WriteLine("Not found in the list of commands!"); HelperMethods.WaitForUser(); continue; // jump back to the start of loop } if (IsSettingMenu) { if (item.Shortcut.Equals("A")) { Options.SetDefaultOptions(); } else { OptionChangingFromMenu(item.Description); } Console.WriteLine("Option changed"); HelperMethods.WaitForUser(); continue; } if (IsGameMenu) { if (item.Shortcut.Equals("A")) { Game.FullGame(); continue; } if (item.Shortcut.Equals("B")) { Game.SelectGameAndStart(); continue; } } // execute the command specified in the menu item if (item.CommandToExecute == null) { Console.WriteLine(input + " has no command assigned to it!"); HelperMethods.WaitForUser(); continue; // jump back to the start of loop } // everything should be ok now, lets run it! var chosenCommand = item.CommandToExecute(); input = chosenCommand; if (IsMainMenu == false && chosenCommand == QuitToMainItem.Shortcut) { break; } if (chosenCommand != GoBackItem.Shortcut && chosenCommand != QuitToMainItem.Shortcut) { HelperMethods.WaitForUser(); } ; } while (done != true); return(input); }
public Plugin() { MenuItems.Add(MenuItemPosition.MainMenuTools, new MenuItem("$Astrarium.Plugins.JupiterMoons.ToolsMenu", new Command(() => ViewManager.ShowWindow <JupiterMoonsVM>(isSingleInstance: true)))); }