private static void Life() { while (true) { var key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.S: GameManager.Stop(); InformationManager.Stop(); break; case ConsoleKey.C: GameManager.Continue(); InformationManager.Continue(); break; case ConsoleKey.Enter: InformationManager.Stop(); GameManager.Stop(); Thread.Sleep(200); // Fix information manager thread InformationManager.ShowCamerasMenu(); InformationManager.Continue(); GameManager.Continue(); break; } } }
private static void GameManagerDestructor(object sender, EventArgs e) { try { Stop(); InformationManager.Stop(); BinaryFormatter formatter = new BinaryFormatter(); using (FileStream fs = new FileStream(BackupFileName, FileMode.Create)) { lock (games) { formatter.Serialize(fs, games); } } } catch (Exception ex) { Logger.Log(ex); throw ex; } }