public async Task <IActionResult> PutMenuItemOption([FromRoute] int id, [FromBody] MenuItemOption menuItemOption) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != menuItemOption.Id) { return(BadRequest()); } _context.Entry(menuItemOption).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuItemOptionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
// Switches to the input waiting state private void WaitForInput() { MenuItemOption option = SelectedItem.SelectedOption; option.Text = "..."; _isWaitingForInput = true; }
// Changes the key binding and resets to the normal state private void SetKey(Keys key) { MenuItemOption option = SelectedItem.SelectedOption; option.Text = InputManager.GetKeyDescription(key); option.Value = key; _isWaitingForInput = false; }
public async Task <IActionResult> PostMenuItemOption([FromBody] MenuItemOption menuItemOption) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MenuItemOptions.Add(menuItemOption); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMenuItemOption", new { id = menuItemOption.Id }, menuItemOption)); }
private void Configure(UITableViewCell cell, NSIndexPath indexPath, OrderDetailTableConfiguration.SectionModel sectionModel) { switch (sectionModel.Type) { case OrderDetailTableConfiguration.SectionType.Price: if (!(cell.TextLabel is null)) { cell.TextLabel.Text = NSNumberFormatterHelper.CurrencyFormatter.StringFromNumber(Order.MenuItem.Price); } break; case OrderDetailTableConfiguration.SectionType.Quantity: var quantityCell = cell as QuantityCell; if (!(quantityCell is null)) { if (TableConfiguration.OrderType == OrderDetailTableConfiguration.OrderTypeEnum.New) { QuantityLabel = quantityCell.GetQuantityLabel(); UIStepper stepper = quantityCell.GetStepper(); if (!(stepper is null)) { stepper.AddTarget(StepperDidChange, UIControlEvent.ValueChanged); } } else { quantityCell.GetQuantityLabel().Text = $"{Order.Quantity}"; quantityCell.GetStepper().Hidden = true; } } break; case OrderDetailTableConfiguration.SectionType.Options: // Maintains a mapping of values to localized values in // order to help instantiate Order.MenuItemOption later // when an option is selected in the table view var option = new MenuItemOption(MenuItemOption.All[indexPath.Row]); var localizedValue = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase( option.LocalizedString ); OptionMap[localizedValue] = option.Value; if (!(cell.TextLabel is null)) { cell.TextLabel.Text = localizedValue; } if (TableConfiguration.OrderType == OrderDetailTableConfiguration.OrderTypeEnum.Historical) { cell.Accessory = Order.MenuItemOptions.Contains(option) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; } break; case OrderDetailTableConfiguration.SectionType.Total: TotalLabel = cell.TextLabel; UpdateTotalLabel(); break; case OrderDetailTableConfiguration.SectionType.VoiceShortcut: if (!(cell.TextLabel is null)) { cell.TextLabel.TextColor = TableView.TintColor; var shortcut = VoiceShortcutDataManager.VoiceShortcutForOrder(Order); if (!(shortcut is null)) { cell.TextLabel.Text = $"“{shortcut.InvocationPhrase}”"; }
// Sets up the options to show on the page private void CreateGameplaySettingItems() { IGameplaySettings gameplaySettings = _settingsManager.Settings.Gameplay; // Add player type selection IList <Type> paddleTypes = PaddleFactory.GetSupportedTypes(); _playersItem = new MenuItem { Name = StringResources.Players }; MenuItemOption selectedPlayerOption = null; // Add all available left+right player combinations, for example: "AI vs. Player" foreach (Type leftPaddleType in paddleTypes) { foreach (Type rightPaddleType in paddleTypes) { string text = string.Format("{0} {1} {2}", StringResources.ResourceManager.GetString("MenuText_Paddle_" + leftPaddleType.Name), StringResources.versus, StringResources.ResourceManager.GetString("MenuText_Paddle_" + rightPaddleType.Name)); Tuple <Type, Type> value = new Tuple <Type, Type>(leftPaddleType, rightPaddleType); MenuItemOption option = new MenuItemOption { Text = text, Value = value }; _playersItem.Options.Add(option); if (leftPaddleType == gameplaySettings.LeftPaddleType && rightPaddleType == gameplaySettings.RightPaddleType) { selectedPlayerOption = option; } } } if (selectedPlayerOption != null) { _playersItem.SelectedOption = selectedPlayerOption; } Items.Add(_playersItem); // Add score limit item _scoreLimitItem = new MenuItem { Name = StringResources.ScoreLimit }; _scoreLimitItem.Options.Add(new MenuItemOption { Text = StringResources.None, Value = 0 }); foreach (int scoreLimit in new[] { 5, 10, 20, 30 }) { string text = string.Format("{0} {1}", scoreLimit, StringResources.pts); _scoreLimitItem.Options.Add(new MenuItemOption { Text = text, Value = scoreLimit }); } _scoreLimitItem.SelectedValue = gameplaySettings.ScoreLimit; Items.Add(_scoreLimitItem); // Add time limit item _timeLimitItem = new MenuItem { Name = StringResources.TimeLimit }; _timeLimitItem.Options.Add(new MenuItemOption { Text = StringResources.None, Value = TimeSpan.Zero }); foreach (int timeLimit in new[] { 5, 10, 20, 30 }) { string text = string.Format("{0} {1}", timeLimit, StringResources.minutes); _timeLimitItem.Options.Add(new MenuItemOption { Text = text, Value = TimeSpan.FromMinutes(timeLimit) }); } _timeLimitItem.SelectedValue = gameplaySettings.TimeLimit; Items.Add(_timeLimitItem); // Add ball count item _ballCountItem = new MenuItem { Name = StringResources.Balls }; for (int i = SettingsConstants.BallMinCount; i <= SettingsConstants.BallMaxCount; i++) { _ballCountItem.Options.Add(new MenuItemOption { Text = i.ToString(), Value = i }); } _ballCountItem.SelectedValue = gameplaySettings.BallCount; Items.Add(_ballCountItem); // Add game speed item _gameSpeedItem = new MenuItem { Name = StringResources.GameSpeed }; for (float i = SettingsConstants.GameSpeedMinValue; i <= SettingsConstants.GameSpeedMaxValue; i = (float)Math.Round(i + SettingsConstants.GameSpeedIncreaseFactor, 1)) { string text = string.Format("{0}%", (int)Math.Round(i * 100F, 1)); _gameSpeedItem.Options.Add(new MenuItemOption { Text = text, Value = i }); } _gameSpeedItem.Options.Add(new MenuItemOption { Text = StringResources.AutoIncrease, Value = null }); _gameSpeedItem.SelectedValue = gameplaySettings.AutoIncreaseSpeed ? null : (object)gameplaySettings.GameSpeed; Items.Add(_gameSpeedItem); }