public void Clear() { int count = 0; IEnumerable <Category> categories = Category.GetAll(); foreach (Category category in categories) { if ((category.DisplayIndex < 0) || (category.DisplayIndex >= Buttons.Length)) { continue; } TextBlockButton button = Buttons[category.DisplayIndex]; button.Tag = category.Id.ToString(CultureInfo.InvariantCulture); button.Text = StringHelper.ThinString(category.NameValue); button.Visibility = Visibility.Hidden; count++; } for (int i = count; i < Buttons.Length; i++) { TextBlockButton button = Buttons[i]; button.Tag = "0"; button.IsChecked = false; button.Text = ""; button.Visibility = Visibility.Hidden; } }
private void Button_Click(object sender, RoutedEventArgs e) { TextBlockButton button = (TextBlockButton)sender; UpdateTicketOptions(button); UpdateReceiptTapeItem(); }
private void DoClick(TextBlockButton button, int index) { if (Click != null) { Click.Invoke(this, new ButtonTouchInputClickArgs(index)); } }
public void SetOptions(int itemOptionSetId) { int index = 0; Visibility = Visibility.Visible; ItemOptionSet set = ItemOptionSet.Get(itemOptionSetId); IsBeingUsed = !set.IsPizzaStyle; if (IsBeingUsed) { foreach (ItemOption option in ItemOption.GetInSet(itemOptionSetId)) { TextBlockButton button = Buttons[index]; button.Tag = option.Id.ToString(CultureInfo.InvariantCulture); button.IsChecked = false; button.Text = StringHelper.ThinString(option.Name); button.Visibility = Visibility.Visible; index++; } SelectedMaximum = set.SelectedMaximum; SelectedMinimum = set.SelectedMinimum; } for (int i = index; i < Buttons.Length; i++) { TextBlockButton button = Buttons[i]; button.Tag = "0"; button.IsChecked = false; button.Text = ""; button.Visibility = Visibility.Hidden; } }
private void UpdateTicketOptions(TextBlockButton button) { if ((SessionManager.ActiveTicketItem == null) || (button == null)) { return; } // DEBUG: This isn't always going to be 'this' simple... If the ingredient // is already on, then it's might be getting removed (not added)... It // might also indicate the addition of extra. Change count (the constant '1', // in the Add() below) is always positive, even on deletions. It's a factor // that allows support for "extra-extra" type options. if (button.IsChecked == true) { if (!TicketItemOption.HasOption(SessionManager.ActiveTicketItem.PrimaryKey, GetId(button))) { TicketItemOption option = TicketItemOption.Add(SessionManager.ActiveTicketItem.PrimaryKey.Id, GetId(button), PosModels.Types.TicketItemOptionType.None, 1); } } else { TicketItemOption.Delete(SessionManager.ActiveTicketItem, GetId(button), true); } OrderEntryControl.UpdateDisplayedOrderAmount(); }
void buttonTouchInputOptions3_Click(object sender, EventHandlers.ButtonTouchInputClickArgs args) { TextBlockButton button = buttonTouchInputOptions3.Buttons[args.ButtonIndex]; UpdateTicketOptions(button); UpdateReceiptTapeItem(); OrderEntryCommands.UpdateInOrderCommands(); }
private void Button_Click(object sender, RoutedEventArgs e) { TextBlockButton button = (TextBlockButton)sender; SelectedSeatingId = _seatingIds[button]; SelectedIndex = GetIndex(button); SelectedTableName = Buttons[SelectedIndex].Text.Replace(Environment.NewLine, " "); Window.GetWindow(this).Close(); }
private void Button_PreviewMouseDown(object sender, MouseButtonEventArgs e) { TextBlockButton button = (TextBlockButton)sender; if (button.ContextMenu != null) { button.ContextMenu.IsOpen = true; e.Handled = true; } }
public int GetId(TextBlockButton button) { try { return(Convert.ToInt32(button.Tag as string)); } catch { return(0); } }
public static void Set(this TextBlockButton button, string text, bool isShown) { if (isShown) { Show(button, text); } else { Collapse(button); } }
private void InsertMakeNowButton() { TextBlockButton button = new TextBlockButton(); button.Text = Strings.FutureTimeMakeNow; button.Margin = new Thickness(5, 0, 5, 0); button.Click += buttonMakeNow_Click; button.Width = 70; button.Height = 64; dateTimeComboControl.StackPanelButtons.Children.Insert(0, button); }
public int GetIndex(TextBlockButton button) { for (int i = 0; i < Buttons.Length; i++) { if (Equals(button, Buttons[i])) { return(i); } } return(-1); }
private void AssignSeatingIdToButton(TextBlockButton button, int id) { if (_seatingIds.ContainsKey(button)) { _seatingIds[button] = id; } else { _seatingIds.Add(button, id); } }
private void Button_Click(object sender, RoutedEventArgs e) { TextBlockButton source = (TextBlockButton)sender; int index = GetIndex(source); if (source.IsChecked != true) { if (PreSelectedCount + 1 > SelectedMinimum) { // Unselection allowed DoClick(source, index); } else { source.IsChecked = true; } } if ((SelectedMaximum == 1) && (PreSelectedCount == 1)) { for (int i = 0; i < Buttons.Length; i++) { if ((Equals(Buttons[i], sender)) || (Buttons[i].IsChecked != true)) { continue; } Buttons[i].IsChecked = false; if (Click != null) { Click.Invoke(this, new ButtonTouchInputClickArgs(i)); } } // Selection is only the sender DoClick(source, index); } else if (PreSelectedCount < SelectedMaximum) { // Selection is allowed DoClick(source, index); } else { source.IsChecked = false; } }
private void UpdateTicketOptions(TextBlockButton button) { if (button.IsChecked == true) { if (!TicketItemOption.HasOption(SessionManager.ActiveTicketItem.PrimaryKey, GetId(button))) { TicketItemOption option = TicketItemOption.Add(SessionManager.ActiveTicketItem.PrimaryKey.Id, GetId(button), PosModels.Types.TicketItemOptionType.Add, 1); } } else { TicketItemOption.Delete( SessionManager.ActiveTicketItem, GetId(button), true); } OrderEntryControl.UpdateDisplayedOrderAmount(); }
private void Button_Click(object sender, RoutedEventArgs e) { int index = GetIndex((TextBlockButton)sender); // Set the ActiveCategory property for (int i = 0; i < Buttons.Length; i++) { TextBlockButton button = Buttons[i]; if (i == index) { ActiveCategory = Category.Get(GetId(button)); button.IsChecked = true; } else { button.IsChecked = false; } } UpdateItems(); }
private void Button_Click(object sender, RoutedEventArgs e) { #if DEMO if (OrderEntryControl.CurrentTicketItemCount >= 3) { ((TextBlockButton)sender).IsChecked = false; PosDialogWindow.ShowDialog( Strings.YouCanNotAddMoreThan3TicketItemsToATicketInTheDemoVersion, Strings.DemoRestriction); return; } #endif int index = GetIndex((TextBlockButton)sender); // Set the ActiveItem property Item foundItem = null; for (int i = 0; i < Buttons.Length; i++) { TextBlockButton button = Buttons[i]; if (i == index) { button.IsChecked = true; foundItem = Item.Get(GetId(button)); } else { button.IsChecked = false; } } if ((SessionManager.ActiveItem != null) && (foundItem != null) && (SessionManager.ActiveItem.Id == foundItem.Id)) { NotifyParent(true); } else { SessionManager.ActiveItem = foundItem; NotifyParent(false); } }
internal void SetItemOptions(Item item) { if ((item.ItemOptionSetIds[0] == 0) && (item.ItemOptionSetIds[1] == 0) && (item.ItemOptionSetIds[2] == 0)) { Visibility = Visibility.Collapsed; Clear(); return; } int index = 0; ItemOptionSet set = ItemOptionSet.Get(item.ItemOptionSetIds[0]); IsBeingUsed = set.IsPizzaStyle; Visibility = (IsBeingUsed ? Visibility.Visible : Visibility.Collapsed); if (IsBeingUsed) { IEnumerable <ItemOption> options = ItemOption.GetInSet(item.ItemOptionSetIds[0]); foreach (ItemOption option in options) { TextBlockButton button = Buttons[index]; button.Tag = option.Id.ToString(CultureInfo.InvariantCulture); button.IsChecked = false; button.Text = StringHelper.ThinString(option.Name); button.Visibility = Visibility.Visible; index++; } //SelectedMaximum = set.SelectedMaximum; //SelectedMinimum = set.SelectedMinimum; } for (int i = index; i < Buttons.Count; i++) { TextBlockButton button = Buttons[i]; button.Tag = "0"; button.IsChecked = false; button.Text = ""; button.Visibility = Visibility.Hidden; } }
public void Show(int categoryId) { Category category = Category.Get(categoryId); int index = 0; if (category != null) { foreach (Item item in Item.GetAllForCategory(category.Id)) { if (!item.IsActive) { continue; } TextBlockButton button = Buttons[index]; button.Tag = item.Id.ToString(CultureInfo.InvariantCulture); button.IsChecked = false; button.IsEnabled = !item.IsOutOfStock; string buttonName = item.ShortName; if (String.IsNullOrEmpty(buttonName)) { buttonName = item.FullName; } button.Text = StringHelper.ThinString(buttonName); button.Visibility = Visibility.Visible; index++; } } for (int i = index; i < Buttons.Length; i++) { TextBlockButton button = Buttons[i]; button.Tag = "0"; button.IsChecked = false; button.Text = ""; button.Visibility = Visibility.Hidden; } }
public static void Show(this TextBlockButton button, string text) { button.Text = text; button.Visibility = Visibility.Visible; }
public static void Hide(this TextBlockButton button) { button.Text = ""; button.Visibility = Visibility.Hidden; }
public static void Collapse(this TextBlockButton button) { button.Text = ""; button.Visibility = Visibility.Collapsed; }
void SessionManager_ActiveTicketItemChanged(object sender, EventArgs e) { TextBlockButton siButton = null, ciButton = null, viButton = null; Item item = SessionManager.ActiveItem; TicketItem ticketItem = SessionManager.ActiveTicketItem; if ((item == null) || (ticketItem == null)) { #if OLDCODE ciButton = actionBar.FindButton(Strings.OrderEntryCancelItem); if (ciButton != null) { ciButton.IsEnabled = false; } viButton = actionBar.FindButton(Strings.OrderEntryVoidItem); if (viButton != null) { viButton.IsEnabled = false; } siButton = actionBar.FindButton(Strings.OrderEntrySpecialInstructions); if (siButton != null) { siButton.IsEnabled = false; } #endif return; } // Setup Category buttonTouchInputCategory.Show(); SessionManager.ActiveCategory = buttonTouchInputCategory.ActiveCategory = Category.Get(item.CategoryId); buttonTouchInputCategory.SelectCategoryButton(item.CategoryId); // Setup item orderEntryItemSelection.Show(item.CategoryId); orderEntryItemSelection.SelectItemButton(item.Id); // Setup item options orderEntryItemOptions.Clear(); orderEntryPizzaItemOptions.Clear(); orderEntryItemOptions.SetItemOptions(item); orderEntryPizzaItemOptions.SetItemOptions(item); orderEntryItemOptions.SetupTicketItemOptions(ticketItem); orderEntryPizzaItemOptions.SetupTicketItemOptions(ticketItem); // Setup coupon entry control couponEntryControl.SelectedTicketItem = ticketItem; #if OLDCODE ciButton = actionBar.FindButton(Strings.OrderEntryCancelItem); if (ciButton != null) { ciButton.IsEnabled = true; } viButton = actionBar.FindButton(Strings.OrderEntryVoidItem); if (viButton != null) { viButton.IsEnabled = true; } siButton = actionBar.FindButton(Strings.OrderEntrySpecialInstructions); if (siButton != null) { siButton.IsEnabled = true; } #endif }