public async Task <bool> fnThreadDBActionsAction() { // Check any Flights that is more than 60 * 3 seconds old, then // Generate the report and remove the flights foreach (String Key in WorkerProcess.Keys()) { DroneDataProcessor TheFlight = WorkerProcess.Flight(Key); Double ElapsedTime = TheFlight.GetElapsed(); if (ElapsedTime > 30) { //Generate the report await TheFlight.UpdateFlightSummary(); await TheFlight.GenerateReport(); WorkerProcess.RemoveProximity(Key); WorkerProcess.RemoveFlight(Key); TheFlight = null; } } //Update the Flight information back to Database await WorkerProcess.UpdateFlightsToDB(); //Update Proximity of active flights await WorkerProcess.GenerateProximity(); //Load list of alerts required to send await AlertQueue.LoadQueue(); return(true); }
private void _timerEvent1(object Source, System.Timers.ElapsedEventArgs e) { SetText(txtPendingRecords, WorkerProcess.GetPendingDataCount().ToString()); gridFlights.Invoke(new Action(() => { ResetFlightsGrid(); int Row = 0; foreach (String Key in WorkerProcess.Keys()) { Row++; gridFlights.Rows.Insert(Row); for (var i = 0; i <= 9; i++) { gridFlights[Row, i] = WorkerProcess.Flight(Key).Cell(i); } } gridFlights.AutoSizeCells(); })); }