public IHttpActionResult PostMenuLocation(MenuLocation menuLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { db.Add(menuLocation); } catch (DbUpdateException) { if (MenuLocationExists(menuLocation.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = menuLocation.Id }, menuLocation)); }
public void LeaveTheLevel() { //UnloadLevel(CurrentLevelName); LoadLevel("SampleScene"); isPlayingGame = false; MenuRightNow = MenuLocation.Main; }
private string ChoosePropFindBy <T>() where T : RawData, new() { bool valid; int input; var propNames = new T().PropNames(); do { Console.WriteLine("* Choose field to find by\n"); for (int i = 0; i < propNames.Length; i++) { Console.WriteLine($"* {i + 1}) {propNames[i]}"); } Console.WriteLine($"* {propNames.Length + 1}) BACK"); input = Console.ReadKey(true).KeyChar - '1'; valid = input >= 0 && input <= propNames.Length; if (valid) { if (input == propNames.Length) { Location = MenuLocation.TableMenu; return(null); } } Console.Clear(); } while (!valid); Location = MenuLocation.ChooseReg; return(propNames[input]); }
// Methods // ======= /// <exception cref="InvalidDataException"></exception> public IScriptConfig Generate(IScriptStorageModel script, MenuLocation menuLocation) { if (!IsValidRegistryKeyName(script.Name, out RegistryName registryName)) { throw new InvalidDataException($"The given registry key's name [{script.Name}] must be [RRC_XX_YYY] where [XX] is a number and [YYY] is of any length greater than 0"); } IScriptConfig newConfig = null; try { newConfig = TryCastToBatScriptConfig(script, registryName, menuLocation); if (newConfig == null) { newConfig = TryCastToPowershellScriptConfig(script, registryName, menuLocation); } if (newConfig == null) { throw new InvalidDataException($"The right-click command [{registryName.Name}] appears to be corrupt. Please delete and re-create it"); } } catch (UnauthorizedAccessException) { //Nothing needed } return(newConfig); }
public Guid Add(MenuLocation menuLocation) { db.Add(menuLocation); db.SaveChanges(); return(menuLocation.Id); }
public MenuLocation Update(MenuLocation menuLocation) { db.Update(menuLocation); db.SaveChanges(); return(menuLocation); }
public IHttpActionResult PutMenuLocation(Guid id, MenuLocation menuLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != menuLocation.Id) { return(BadRequest()); } try { this.db.Update(menuLocation); } catch (DbUpdateConcurrencyException) { if (!MenuLocationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { MenuLocation menuLocation = db.MenuLocations.Find(id); db.MenuLocations.Remove(menuLocation); db.SaveChanges(); return(RedirectToAction("Index")); }
public void PlayTheLevel(string PassName) { //UnloadLevel(CurrentLevelName); LoadLevel(PassName); CurrentLevelName = PassName; isPlayingGame = true; MenuRightNow = MenuLocation.Gameplay; }
public IEnumerable <MenuItem> Build(MenuLocation location) { ToolboxApp.Log.Trace($"Creating context menu items for {location}."); var found = CreateMenuItems(a => a.Location.HasFlag(location)); ToolboxApp.Log.Trace($"Done creating menu items for {location}."); return(found); }
public bool Test_IsForLocation(MenuLocation location, bool onDirectory, bool onBackground) { subject.Object.OnBackground = onBackground; subject.Object.OnDirectory = onDirectory; bool result = subject.Object.IsForLocation(location); return(result); }
public void Test_ModifyLocation(MenuLocation location, bool enable, bool onDirectoryState, bool onBackgroundState, bool onDirectoryResult, bool onBackgroundResult) { subject.Object.OnDirectory = onDirectoryState; subject.Object.OnBackground = onBackgroundState; subject.Object.ModifyLocation(location, enable); Assert.AreEqual(onDirectoryResult, subject.Object.OnDirectory); Assert.AreEqual(onBackgroundResult, subject.Object.OnBackground); }
public IActionResult MenuLocationEdit(MenuLocation menuLocation) { if (ModelState.IsValid) { menuLocationService.UpdateMenuLocation(menuLocation); menuLocationService.SaveMenuLocation(); return(RedirectToAction("MenuLocationIndex", "Menu")); } return(View(menuLocation)); }
public ActionResult Edit([Bind(Include = "Id,Name")] MenuLocation menuLocation) { if (ModelState.IsValid) { db.Entry(menuLocation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(menuLocation)); }
public ActionResult Create([Bind(Include = "Id,Name")] MenuLocation menuLocation) { if (ModelState.IsValid) { db.MenuLocations.Add(menuLocation); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(menuLocation)); }
private List <Menu> GetMenus(MenuLocation menuLocation) { List <Menu> menus; if (!menusByLocation.TryGetValue(menuLocation, out menus)) { menus = new List <Menu>(); menusByLocation[menuLocation] = menus; } return(menus); }
public IHttpActionResult GetMenuLocation(Guid id) { MenuLocation menuLocation = db.GetById(id); if (menuLocation == null) { return(NotFound()); } return(Ok(menuLocation)); }
public bool Delete(Guid id) { MenuLocation menuLocation = db.GetById(id); if (menuLocation == null) { return(false); } db.Delete(menuLocation); db.SaveChanges(); return(true); }
// GET: Admin/MenuLocations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MenuLocation menuLocation = db.MenuLocations.Find(id); if (menuLocation == null) { return(HttpNotFound()); } return(View(menuLocation)); }
static void Main(string[] args) { Console.Title = "Best Game Ever"; MenuManager menuManager = new MenuManager(); Player player = new Player(); Console.Write("Please enter your name: "); player.Name = Console.ReadLine(); MenuLocation current = MenuLocation.Main; do { Console.Clear(); switch (current) { case MenuLocation.Main: current = menuManager.MainMenuBuilder($"Hello {player.Name}, choose an action : "); break; case MenuLocation.ShowInventory: menuManager.ShowInventory(player.InventoryItems); current = MenuLocation.Main; break; case MenuLocation.ShowPlayerInfo: menuManager.ShowPlayerInfo(player); current = MenuLocation.Main; break; case MenuLocation.BattleArena: menuManager.GoToBattleArena(player); current = MenuLocation.Main; break; default: break; } } while (current != MenuLocation.Exit); Console.Clear(); menuManager.PrintGoBackMessage("Press a button to exit the game."); Console.ReadLine(); }
/// <summary> /// Fade between menu screens /// </summary> /// <param name="animatorToFadeOut"></param> /// <param name="canvasToDisable"></param> /// <param name="animatorToFadeIn"></param> /// <param name="canvasToEnable"></param> /// <param name="destination"></param> /// <returns></returns> public IEnumerator FadeOutFadeIn(Animator animatorToFadeOut, Canvas canvasToDisable, Animator animatorToFadeIn, Canvas canvasToEnable, MenuLocation destination) { animatorToFadeOut.SetTrigger("fade"); yield return(new WaitForSeconds(1.5f)); canvasToDisable.gameObject.SetActive(false); canvasToEnable.gameObject.SetActive(true); animatorToFadeIn.SetTrigger("fadeIn"); menuLocation = destination; yield break; }
static void Main(string[] args) { MenuManager menuManager = new MenuManager(); Company company = new Company("DDT Oké Cars"); Console.Title = company.CompanyName; MenuLocation current = MenuLocation.Main; do { Console.Clear(); switch (current) { case MenuLocation.Main: current = menuManager.MainMenuBuilder(); break; case MenuLocation.ShowCars: menuManager.ShowCars(company.Cars); current = MenuLocation.Main; break; case MenuLocation.AddCar: menuManager.AddCar(company.Cars); current = MenuLocation.Main; break; case MenuLocation.EditCar: menuManager.EditCar(company.Cars); current = MenuLocation.Main; break; case MenuLocation.RemoveCar: menuManager.RemoveCar(company.Cars); current = MenuLocation.Main; break; default: break; } } while (current != MenuLocation.Exit); Console.Clear(); menuManager.PrintGoBackMessage("Press a button to exit the application."); }
public IEnumerable <MenuItem> Build(MenuLocation location, IEnumerable <ViewRegistration> registrations) { var views = registrations as ViewRegistration[] ?? registrations.ToArray(); var items = views.Select(v => new BuildItem { Value = v, Path = v.Path }); ToolboxApp.Log.Trace($"Creating plugin menu items for {location} with {views.Length} {nameof(ViewRegistration)}s."); var result = CreateMenuItems(a => a.Location.HasFlag(location), items); ToolboxApp.Log.Trace($"Done creating plugin menu items for {location}."); return(result); }
public void Start() { menus = new Menus(this); context = new ComicsContext(); AssignActions(); Location = MenuLocation.MainMenu; do { UpdateContext(); switch (Location) { case MenuLocation.MainMenu: exit = menus.MainMenu(); break; case MenuLocation.TableMenu: menus.TableMenu(); break; case MenuLocation.ActionMenu: actions[(int)menus.mainMenuSelection, (int)menus.tableSelection](); context.SaveChanges(); Location = MenuLocation.MainMenu; break; case MenuLocation.StatisticsMenu: menus.StatisticsMenu(); break; case MenuLocation.StatisticViewer: statistics[(int)menus.statisticSelection](); Location = MenuLocation.MainMenu; break; default: exit = true; break; } Console.Clear(); } while (!exit); context.Dispose(); }
public void SetupMenuButton(SkyhunterCanvas canvas, MenuLocation location) { switch (location) { case MenuLocation.Top: this.Orientation = 180.0; this.Center = new Point(canvas.CanvasWidth / 2, this.ActualHeight / 2); break; case MenuLocation.Right: this.Orientation = 270.0; this.Center = new Point(canvas.CanvasWidth - this.ActualHeight / 2, canvas.CanvasHeight / 2); break; case MenuLocation.Bottom: this.Orientation = 0.0; this.Center = new Point(canvas.CanvasWidth / 2, canvas.CanvasHeight - this.ActualHeight / 2); break; case MenuLocation.Left: this.Orientation = 90.0; this.Center = new Point(this.ActualHeight / 2, canvas.CanvasHeight / 2); break; } }
//private int nesting = 0; private void Update() { if (Input.GetKeyDown(KeyCode.Escape) && Time.timeScale == 0) { GameController.Instance.LoadMainScene(); GameController.Instance.ResumeGame(); } else if (Input.GetKeyDown(KeyCode.Escape) && SceneManager.GetActiveScene().name == "menu") { switch (currentLocation) { case MenuLocation.MainMenu: DataManager.Instance.SaveGameData(); Application.Quit(); break; case MenuLocation.Map: StartCoroutine(BackToMainMenu(m_MapButton)); currentLocation = MenuLocation.MainMenu; break; case MenuLocation.Market: StartCoroutine(BackToMainMenu(m_MarketButton)); currentLocation = MenuLocation.MainMenu; break; case MenuLocation.Achievements: StartCoroutine(BackToMainMenu(m_AchievementsButton)); currentLocation = MenuLocation.MainMenu; break; case MenuLocation.Info: StartCoroutine(BackToMainMenu(m_InfoButton)); currentLocation = MenuLocation.MainMenu; break; } } }
private bool EnsureDelete(RawData reg) { bool exit = false; bool ensure = false; int selection = 0; ConsoleKeyInfo key; do { Console.WriteLine("* DO YOU WANT TO DELETE THIS?"); Console.WriteLine("*"); PrintReg(reg, "* ", "", RegStyle.VerticalFields); Console.WriteLine("*"); Console.WriteLine($"* {(selection == 0 ? "[NO]" : " NO ")} {(selection == 1 ? "[YES]" : " YES ")}"); key = Console.ReadKey(true); if (key.Key == ConsoleKey.LeftArrow || key.Key == ConsoleKey.RightArrow) { selection += (key.Key == ConsoleKey.RightArrow) ? 1 : -1; selection += 2; selection %= 2; } else if (key.Key == ConsoleKey.Enter) { exit = true; ensure = selection == 1; } else if (key.Key == ConsoleKey.Escape) { exit = true; Location = MenuLocation.MainMenu; } Console.Clear(); } while (!exit); return(ensure); }
public Menu(SkyhunterCanvas canvas, MenuLocation location, MenuButtonControl externalButton) { InitializeComponent(); Loaded += OnLoaded; SetupMenu(canvas, location, externalButton); }
/// <summary> /// Builds a menu based on the parameters given /// </summary> /// <typeparam name="T">The type of data the menu should hold</typeparam> /// <param name="parentControl">The parent control this menu resides in</param> /// <param name="menuLayout">The standard layout to use, either horizontal or vertical</param> /// <param name="menuLocation">The location in the screen the menu is located at</param> /// <param name="appearance">The appearance this menu should take<para>Leave null for default layout</para></param> /// <param name="eventFunction">The function to execute when the tab changes</param> /// <returns>A menu based on the parameters given</returns> public static IMenu <T> Build <T>(Control parentControl, MenuLayout menuLayout, MenuLocation menuLocation, MenuAppearance appearance = null, EventHandler <TabChangedEventArgs <T> > eventFunction = null) { var menu = new Menu <T> { appearance = appearance ?? MenuAppearance.GetDefaultAppearance(), allowRightClick = false, parentControl = parentControl, currentTabIndex = -1, currentMouseMode = MouseModes.mouseClick, }; switch (menuLayout) { case MenuLayout.horizontal: menu.menuDrawer = new HorizontalMenuDrawer(); menu.tabDrawer = new HorizontalTabDrawer(); menu.clickHandler = new HorizontalClickHandler(); break; case MenuLayout.vertical: menu.menuDrawer = new VerticalMenuDrawer(); menu.tabDrawer = new VerticalTabDrawer(); menu.clickHandler = new VerticalClickHandler(); break; } switch (menuLocation) { case MenuLocation.top: menu.tabDrawer.tabLocationDrawer = new TopTabLocationDrawer(); break; case MenuLocation.right: menu.tabDrawer.tabLocationDrawer = new RightTabLocationDrawer(); break; case MenuLocation.bottom: menu.tabDrawer.tabLocationDrawer = new BottomTabLocationDrawer(); break; case MenuLocation.left: menu.tabDrawer.tabLocationDrawer = new LeftTabLocationDrawer(); break; } parentControl.Paint += menu.OnDraw; parentControl.MouseClick += menu.OnClick; if (eventFunction != null) { menu.tabChanged += eventFunction; } return(menu); }
public void SetupMenu(SkyhunterCanvas canvas, MenuLocation location, MenuButtonControl externalButton) { MyCanvas = canvas; MyLocation = location; ExternalButton = externalButton; ExternalButton.MyButton.Click += SurfaceButton_Click; //disable shadow ApplyTemplate(); this.Background = new SolidColorBrush(Colors.Transparent); this.BorderBrush = new SolidColorBrush(Colors.Transparent); ShowsActivationEffects = false; Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome ssc; ssc = (Microsoft.Surface.Presentation.Generic.SurfaceShadowChrome)this.Template.FindName("shadow", this); ssc.Visibility = Visibility.Hidden; switch (location) { case MenuLocation.Top: this.Orientation = 180.0; this.Center = new Point(canvas.CanvasWidth / 2, this.ActualHeight / 2); break; case MenuLocation.Right: this.Orientation = 270.0; this.Center = new Point(canvas.CanvasWidth - this.ActualHeight / 2, canvas.CanvasHeight / 2); break; case MenuLocation.Bottom: this.Orientation = 0.0; this.Center = new Point(canvas.CanvasWidth / 2, canvas.CanvasHeight - this.ActualHeight / 2); break; case MenuLocation.Left: this.Orientation = 90.0; this.Center = new Point(this.ActualHeight / 2, canvas.CanvasHeight / 2); break; } IsOpen = false; }
/// <summary> /// 获取菜单数据 /// </summary> /// <param name="location"></param> /// <returns></returns> public List<Doc_Info> GetMenu(MenuLocation location) { List<Doc_Info> list = instance.GetListByWhere(" AND Menu_Location='" + location.ToString() + "' AND Menu_Enable='Enable' ORDER BY Menu_Order ASC "); return list; }
public void UpdateMenuLocation(MenuLocation menuLocation) { menuLocationRepository.Update(menuLocation); }
public MenuLocation GetById(Guid id) { MenuLocation menuLocation = db.GetById(id); return(menuLocation); }
public IActionResult MenuLocationCreate() { var menuLocation = new MenuLocation(); return(View(menuLocation)); }