private void LoadDataButton_OnClick(object sender, RoutedEventArgs e) { if (portControl.LoadPortData()) { MessageBox.Show("Data was loaded.", "Loaded", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Could not load data.", "Failure", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
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); }
private static void Initialize() { portControl = new PortControl(); portControl.LoadPortData(); }