public MainWindow()
        {
            InitializeComponent();
            FileIOLoading.ReadAlltoMem(); //Read collections from files
            App.Update_Flights();         //Check for any flights that have taken off since last loading, and moves them as needed.

            //Start a timer to call App.Update_Flights() every 5 minutes, for continuous flight management over time.
            var startTimeSpan  = TimeSpan.Zero;
            var periodTimeSpan = TimeSpan.FromMinutes(5);

            System.Threading.Timer timer1 = null;
            timer1 = new System.Threading.Timer(_ => App.Update_Flights());
            timer1.Change(startTimeSpan, periodTimeSpan);
        }
Ejemplo n.º 2
0
 void Application_Exit(object sender, ExitEventArgs e)
 {
     Console.WriteLine("App closing, saving to file");
     FileIOLoading.WriteAlltoFile();
     hasFirstLoaded = false;
 }