Exemplo n.º 1
0
        private void handleRefreshUi(Simulation simulation)
        {
            var    mySimulation = (MySimulation)simulation;
            double time         = simulation.CurrentTime;

            DoOnGuiThread(labelTime, () =>
            {
                labelTime.Text = TimeFormatter.HoursMinutesSecondsString(time + startTime);
            });

            if (mySimulation.VehiclesDataChanged)
            {
                var vehicles = mySimulation.Vehicles;
                mySimulation.VehiclesDataChanged = false;
                DoOnGuiThread(dataGridVehicles, () =>
                {
                    dataGridVehicles.DataSource = vehicles;
                });

                var microbuses = mySimulation.Microbuses;
                mySimulation.VehiclesDataChanged = false;
                DoOnGuiThread(dataGridMicrobuses, () =>
                {
                    dataGridMicrobuses.DataSource = microbuses;
                });
            }

            if (mySimulation.BusStopsDataChanged)
            {
                var busStops = mySimulation.BusStops;
                mySimulation.BusStopsDataChanged = false;
                DoOnGuiThread(dataGridBusStops, () =>
                {
                    dataGridBusStops.DataSource = busStops;
                });
            }

            updateReplicationStatistics(mySimulation);
        }