private void NavigationManager_LocationChanged(object sender, Microsoft.AspNetCore.Components.Routing.LocationChangedEventArgs e) { NavigationManager.LocationChanged -= NavigationManager_LocationChanged; ParentMenu?.MarkAsRequireRender(); TopMenu.MarkAsRequireRender(); TopMenu.Refresh(); }
private void MenuItem_Click(object sender, EventArgs e) { ParentMenu.RaiseMenuItemSelected(this); if (ChildMenuItems != null) { if (!ChildMenuItems.Expanded) { ChildMenuItems.RollDown(); ChildMenuItems.Expanded = true; } } else { ASP.Control parent = Parent; while (parent != null && !(parent is Menu)) { if (parent is MenuItems && !(parent.Parent is Menu)) { (parent as MenuItems).RollUp(); (parent as MenuItems).Expanded = false; } parent = parent.Parent; } } }
internal override void GoRight() { if (ItemsCount > 0) { int oldIndex = ListIndex; int newIndex = oldIndex; if (ListIndex >= ItemsCount - 1) { newIndex = 0; } else { newIndex++; } ListIndex = newIndex; ParentMenu.ListItemIndexChangeEvent(ParentMenu, this, oldIndex, newIndex, Index); #if FIVEM PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); #endif #if REDM // Has invalid parameter types in API. Call((CitizenFX.Core.Native.Hash) 0xCE5D0FFE83939AF1, -1, "NAV_RIGHT", "HUD_SHOP_SOUNDSET", 1); #endif } }
public async Task OnClickAsync() { if (ParentMenu != null && TopMenu.Mode == MenuMode.Horizontal) { await ParentMenu.CloseAsync(); } TopMenu.ActivateItem(this); if (!string.IsNullOrEmpty(Route)) { if (OnRouteChanging.HasDelegate) { var arg = new BChangeEventArgs <string>(); arg.NewValue = Route; arg.OldValue = currentRoute; await OnRouteChanging.InvokeAsync(arg); if (arg.DisallowChange) { return; } } NavigationManager.NavigateTo(Route); NavigationManager.LocationChanged += NavigationManager_LocationChanged; } }
private void manageUserChoice(int i_UserChoice) { const int k_BackChoice = 0; if (i_UserChoice != k_BackChoice) { MenuItem userItemChoice = m_MenuItems[i_UserChoice - 1]; if (userItemChoice is Menu) { ((Menu)userItemChoice).Show(); } else { userItemChoice.Execute(); Console.Write("{0}<Press any key to return to menu.>", Environment.NewLine); Console.ReadLine(); this.Show(); } } else { if (!(this is MainMenu)) { ParentMenu.Show(); } } }
public override string BackColor() { if (ParentMenu != null) { return(ParentMenu.BackColor()); } return("#3498DB"); }
/// <summary> /// Closes the top menu /// </summary> protected void CollapseUp() { Menu top = ParentMenu.GetTop(); if (top != null) { top.CloseChild(); } }
public void Draw() { ParentMenu.SetNumberOfButtons(Position); int btnY = 5 + 45 * ParentMenu.GetNumberOfButtons(); rect = new Rect(ParentMenu.GetRect().x + 5, ParentMenu.GetRect().y + btnY, ParentMenu.GetWidthSize(), 40); GUI.Button(rect, Text, style); }
protected override void WndProc(ref System.Windows.Forms.Message m) { if (ParentMenu != null && ParentMenu.HandleMenuMessage(ref m)) { return; } base.WndProc(ref m); }
public void OnOver() { if (Options.Mode == MenuMode.Horizontal && ParentMenu != null) { ParentMenu.KeepSubMenuOpen(); } if (Options.Mode == MenuMode.Horizontal || string.IsNullOrWhiteSpace(Options.HoverColor)) { return; } BackgroundColor = Options.HoverColor; }
public void OnOut() { if (Options.Mode == MenuMode.Horizontal) { if (ParentMenu != null) { ParentMenu.CancelClose(); } backgroundColor = Options.BackgroundColor; return; } backgroundColor = isActive ? Options.HoverColor : Options.BackgroundColor; }
internal override void GoLeft() { if (Position > Min) { Position--; ParentMenu.SliderItemChangedEvent(ParentMenu, this, Position + 1, Position, Index); PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); } else { PlaySoundFrontend(-1, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); } }
public void OnClick() { if (ParentMenu != null && TopMenu.Mode == MenuMode.Horizontal) { _ = ParentMenu.CloseAsync(); } if (!string.IsNullOrEmpty(Route)) { navigationManager.NavigateTo(Route); } TopMenu.ActivateItem(this); }
public void Draw() { ParentMenu.SetNumberOfButtons(Position); int btnY = 5 + 45 * ParentMenu.GetNumberOfButtons(); rect = new Rect(ParentMenu.GetRect().x + 5, ParentMenu.GetRect().y + btnY, ParentMenu.GetWidthSize() - 90, 40); if (GUI.Button(rect, Text, Navigation.HighlighedCheck(style, ParentMenu.GetId(), Position))) { Action?.Invoke(); Draw(); } DrawMulButtons(); }
internal override void GoLeft() { string oldValue = CurrentItem; string newSelectedItem = Callback(this, true); CurrentItem = newSelectedItem; ParentMenu.DynamicListItemCurrentItemChanged(ParentMenu, this, oldValue, newSelectedItem); #if FIVEM PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); #endif #if REDM // Has invalid parameter types in API. Call((CitizenFX.Core.Native.Hash) 0xCE5D0FFE83939AF1, -1, "NAV_RIGHT", "HUD_SHOP_SOUNDSET", 1); #endif }
protected override void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (IsEnabled) { ParentMenu.Focus(); ParentMenu.ShowChild ^= true; if (ParentMenu.ShowChild) { ParentMenu.OpenChild(this, true); } else { ParentMenu.CloseChild(); } } }
private void DrawMulButtons() { Rect menuBg = ParentMenu.GetRect(); int btnY = 5 + 45 * Position; if (GUI.Button(new Rect(menuBg.x + ParentMenu.GetWidthSize() - 80, menuBg.y + btnY, 40, 40), "-", Styles.OffStyle)) { DecreaseAction?.Invoke(); Draw(); } if (GUI.Button(new Rect(menuBg.x + ParentMenu.GetWidthSize() - 35, menuBg.y + btnY, 40, 40), "+", Styles.OffStyle)) { IncreaseAction?.Invoke(); Draw(); } }
protected override void OnMouseEnter(object sender, MouseEventArgs e) { if (IsEnabled) { ParentMenu.SetHilightChild(this); if (ParentMenu.ShowChild) { ParentMenu.OpenChild(this, true); } else if (ShowChildMenuOnHover) { ParentMenu.Focus(); ParentMenu.OpenChild(this, true); } } }
protected override void OnInitialized() { base.OnInitialized(); Func <string, bool> matchFunc = TopMenu.Match; if (matchFunc == null) { matchFunc = DefaultMenuMatcher; } if ((!string.IsNullOrWhiteSpace(Options.DefaultActiveIndex) && Options.DefaultActiveIndex == Index) || matchFunc(Route)) { TopMenu.ActivateItem(this); RequireRender = true; ParentMenu?.MarkAsRequireRender(); TopMenu.MarkAsRequireRender(); TopMenu.Refresh(); } }
public ParentMenu GetMenuDataInfo(string menuId, string parentId, string currentPath, string Name, string MenuValue, string OperatingState, string CurrentType) { ParentMenu parentModule = new ParentMenu(); if (CurrentType == "module") { var current = FindModule(this.Modules, menuId); parentModule.Name = current.Name; parentModule.Icon = current.Icon; parentModule.Url = null; parentModule.Buttons = null; } else { Menu current = new Menu(); var modulesData = FindModule(this.Modules, parentId); foreach (Menu menu in modulesData.Menus) { if (menu.ID == menuId) { current = menu; break; } } List <string> ButtonsList = new List <string>(); var currentButtons = ""; for (int i = 0; i < current.Buttons.Count; i++) { ButtonsList.Add(current.Buttons[i].Name); } parentModule.Name = current.Name; parentModule.Url = current.Url; parentModule.Icon = null; parentModule.Buttons = ButtonsList; } return(parentModule); }
/// <summary> /// Occurs when the mouse leaves the menu item /// </summary> /// <param name="e">Arguments for the event</param> protected override void OnMouseLeave(MouseEventArgs e) { base.OnMouseLeave(e); if (ParentMenu != null) { ParentMenu.Focus(); } if (subMenu != null) { openTimer.Stop(); if (subMenu.IsOpen) { closeTimer.Start(); } } UpdateVisualState(); }
public void Show() { Console.WriteLine(Title); Console.WriteLine("====================="); printMenu(); int choiceOfUser = receiveCorrectInput(); Console.Clear(); if (choiceOfUser != 0) { r_MenuItemList[choiceOfUser - 1].ParentMenu = this; r_MenuItemList[choiceOfUser - 1].ActionWhenSelected(); } else { if (!(this is MainMenu)) { ParentMenu.ActionWhenSelected(); } } }
public virtual void Select() { if (SubMenu != null) { _state = EntryState.Selected; Color = ParentMenu.Selected; SubMenu.ActivateScreen(); ParentMenu.ScreenManager.AddScreen(SubMenu); ParentMenu.FreezeScreen(); ParentMenu.HideMouse(); SubMenu.EnableMouse(ParentMenu.MouseTexture); } var handler = Selected; if (handler != null) { _state = EntryState.Selected; Color = ParentMenu.Selected; Selected(this, EventArgs.Empty); } }
protected virtual void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MenuEventArgs args = new MenuEventArgs(); Menu top; if (IsEnabled) { if (Content != null) { } else { top = ParentMenu.GetTop(); args.Tag = this.ID; args.Parameter = this; if (top != null) { top.RaiseItemSelected(this, args); } if (!args.Cancel) { top.CloseChild(); top.ShowChild = false; if (URL != null) { if (URL.OriginalString.Length > 0) { HtmlPage.Window.Navigate(URL); } } } e.Handled = true; } } }
public async Task HandleOnClick(MouseEventArgs args) { if (!RootMenu.Selectable) { return; } RootMenu.SelectItem(this); if (OnClicked.HasDelegate) { await OnClicked.InvokeAsync(args); } if (ParentMenu == null) { return; } if (RootMenu.Mode != MenuMode.Inline) { await ParentMenu?.Collapse(); } }
public void SetupSub(ParentMenu _menu) { _parent = _menu.GetComponent<ParentMenu>(); if (_menu.GetComponent<MainMenu>() != null) { _menuMan = _menu.GetComponent<MainMenu>(); } }
internal override void Select() { ParentMenu.DynamicListItemSelectEvent(ParentMenu, this, CurrentItem); }
internal override void Select() { ParentMenu.ListItemSelectEvent(ParentMenu, this, ListIndex, Index); }
internal override void Select() { ParentMenu.SliderSelectedEvent(ParentMenu, this, Position, Index); }
protected virtual void OnMouseLeave(object sender, MouseEventArgs e) { ParentMenu.SetHilightChild(null); }
protected virtual void OnMouseEnter(object sender, MouseEventArgs e) { ParentMenu.SetHilightChild(this); ParentMenu.OpenChild(this, false); }
public void Setup(ParentMenu _menu) { parentUi = _menu; if (_menu.GetComponent<MainTitleUI>() != null) { mainUi = _menu.GetComponent<MainTitleUI>(); } SETUP = parentUi.PLAYERDAT.SETUP; if (_coll = GetComponent<BoxCollider>()) {_coll.isTrigger = true;} if (GetComponentInChildren<OTSprite>() != null) { spr = GetComponentInChildren<OTSprite>(); stdFrame = spr.frameName; altFrame = spr.frameName +"Alt"; } }