//Button to Change Table Number private void Change_TableNumber(object sender, RoutedEventArgs e) { string changedNumber = Switcher.GetChangeTable().ChangeTableTextBox.Text; if (changedNumber != null) { try { int result = Int32.Parse(changedNumber); if (result < 0 || result > 100) { MessageBox.Show("Invalid Input"); } else { MainWindow.TableNumber = result; Switcher.GetCart().DisplayTableNumber.Text = "Table: " + result.ToString(); Switcher.GetNewMenu().DisplayTableNumber.Text = "Table: " + result.ToString(); Switcher.GetCheckout().DisplayTableNumber.Text = "Table " + result.ToString(); Close_ChangeTable(sender, e); } } catch (FormatException) { Console.WriteLine($"Cannot Parse, not a number!"); MessageBox.Show("Invald input!"); } } }
private void Open_ChangeTable(object sender, RoutedEventArgs e) { Window window = new Window { Title = "Change Table", Content = Switcher.GetChangeTable(), Height = 200, Width = 200 }; window.ShowDialog(); }
//Button to Open up Cart private void Open_Cart(object sender, RoutedEventArgs e) { string changedNumber = Switcher.GetChangeTable().ChangeTableTextBox.Text; Switcher.Switch(Switcher.GetCart()); }