private void SaveDataButton_OnClick(object sender, RoutedEventArgs e) { if (portControl.SavePortData()) { MessageBox.Show("Data was saved.", "Saved", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Failed to save data, try again.", "Failed", MessageBoxButton.OK, MessageBoxImage.Error); } }
private static void ConsoleCommand() { bool inMenu = true; do { if (KeyAvailable) { switch (ReadKey(true).Key) { case ConsoleKey.Escape: inMenu = false; break; case ConsoleKey.W: LoadWindow(); return; case ConsoleKey.R: portControl.AddBoat(HarborHelper.GetRandomBoat().boat); PortMenu(); break; case ConsoleKey.D: portControl.IncrementTime(); PortMenu(); break; case ConsoleKey.S: portControl.SavePortData(); break; case ConsoleKey.L: portControl.LoadPortData(); PortMenu(); break; case ConsoleKey.C: portControl.ResetPort(); PortMenu(); break; } } } while (inMenu); }