/// <summary> /// Deletes the custom location /// </summary> /// <param name="sender">Source menu item</param> public static void Delete(MenuItem sender) { SimpleTeleportTarget target = (sender.Data as SimpleTeleportTarget); Configuration.Location.Targets.RemoveAt(target.Index); Configuration.Location.SaveCustomLocations(); GenerateTargetList(null); MenuStorage.ReturnToPrevMenu(); Utils.ShowNotification(GlobalConst.Message.CL_DELETED); }
/// <summary> /// Generates the custom location target list /// </summary> /// <param name="sender">Source menu item</param> public static void GenerateTargetList(MenuItem sender) { MenuStorage.Menus.Locations.CLTeleporter.Clear(); MenuStorage.Menus.Locations.CLTeleporter.Add(MenuStorage.MenuItems.Location.CustomLocationTeleporter.SaveCurrentLocation); for (int i = 0; i < Configuration.Location.Targets.Count; i++) { SimpleTeleportTarget target = Configuration.Location.Targets[i]; target.Index = i; MenuItem mi = MenuStorage.AddMenuItem(MenuStorage.Menus.Locations.CLTeleporter, Utils.FormatML(FORMAT_TARGET_NAME, target.Name), false, false, MenuStorage.Menus.Locations.CLTeleporters.Item, null, PreEnterTargetItem, null, target); } }
/// <summary> /// Activate this menu item /// </summary> public void OnActivated() { OnPreActivated(); if (IsToggle) { On = !On; } if (SubMenu != null) { if (PreventsEnteringSubMenuOnce) { PreventsEnteringSubMenuOnce = false; } else { MenuStorage.EnterMenu(SubMenu); } } if (Activated != null) { Activated(this); } }
/// <summary> /// Load current configuration /// </summary> /// <param name="sender">Source menu item</param> public static void Load(MenuItem sender) { Configuration.Load(); MenuStorage.InitMenus(); Feature.Init(); }