private void buttonImport_Click(object sender, EventArgs e)
        {
            btnCheckin.Enabled  = true;
            btnDropoff.Enabled  = true;
            btnConveyor.Enabled = true;
            btnSecurity.Enabled = true;
            string filePath = "";

            if (!this.ImportExportHelper(ref filePath, ref readAndWrite))
            {
                MessageBox.Show("Choose file");
                return;
            }
            this._grid = readAndWrite.ReadData(filePath);
            this._simulationSettings.FrontNodes = _grid.CheckTheConnection();
            this.FindDropOffsAfterGridImport(_simulationSettings.FrontNodes);
            this.animationBox.Invalidate();
        }
        public Form1()
        {
            InitializeComponent();
            _engine             = new Engine();
            _simulationSettings = new SimulationSettings();
            _timer                         = new System.Windows.Forms.Timer();
            _timer.Tick                   += _timer_Tick;
            _timer.Interval                = 5000;
            _grid                          = new Grid(animationBox.Width, animationBox.Height, _simulationSettings);
            gbFlightInfo.Enabled           = false;
            gbSettings.Enabled             = false;
            gbStartStop.Enabled            = false;
            departureTimePicker.Value      = DateTime.Now;
            departureTimePicker.Format     = DateTimePickerFormat.Time;
            departureTimePicker.ShowUpDown = true;

            cartesianChart1.DataClick += CartesianChart1OnDataClick;


            pieChartBagsSecurity.Series.Add(new PieSeries()
            {
                Title = "Succeeded", Values = new ChartValues <int> {
                    30
                }, DataLabels = true
            });
            pieChartBagsSecurity.Series.Add(new PieSeries()
            {
                Title = "Failed", Values = new ChartValues <int> {
                    20
                }, DataLabels = true
            });

            PrePopulateCharts();

            SetupGeneralStatsTable();

            ///Mda has to be created first
            btnCheckin.Enabled  = false;
            btnDropoff.Enabled  = false;
            btnConveyor.Enabled = false;
            btnSecurity.Enabled = false;
        }
        private void BtnStop_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("This action will reset everything! Do you want to save you statistics ?", "Export Statistics", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                _engine.WriteStatsToCsv(_simulationSettings, dataStats);
            }

            _engine.Stop();
            _timer.Stop();
            textBoxFlightNumber.Text             = "";
            textBoxNumberOfBags.Text             = "";
            comboBoxCurrentDropOffs.SelectedItem = null;
            lbFlights.Items.Clear();
            _grid.gridTiles.Clear();
            _grid = new Grid(animationBox.Width, animationBox.Height, _simulationSettings);
            //dataStats.ElapsedTimesPerFlight.Clear();
            //dataStats.SimulationTimeElapsed = "";
            //dataStats.TotalBagsTransfered.Clear();
            //dataStats.PscSucceededBagsPerFlight.Clear();
            //dataStats.PscFailedBagsPerFlight.Clear();
            //dataStats.BagsFailedPsc.Clear();
            //dataStats.BagsSucceededPsc.Clear();
            //dataStats.BagsPerFlight.Clear();
            Baggage.AllBaggage = new System.Collections.Concurrent.ConcurrentBag <Baggage>();
            _simulationSettings.FrontNodes.Clear();
            _simulationSettings.Flights.Clear();
            gbStartStop.Enabled             = false;
            btnMain.Enabled                 = true;
            MapImportExportgroupBox.Enabled = true;
            animationBox.Invalidate();


            //clear stats
            pieChartBagsSecurity.Series.Clear();
            PrimarySecurityChart.Series.Clear();
            cartesianChart1.Series.Clear();
            cartesianChartSuccBagsPerFlight.Series.Clear();
            cartesianChartFailedBagsPerFlight.Series.Clear();
        }