private void DistanceAnalysis()
        {
            int pass = 0;

            foreach (var setup in this.setups)
            {
                pass++;
                var patientResults = new List<LocalityResult>();

                var salesman = new TravelingSalesmanAnalyser(setup, this.analysisOptionPanel1);

                salesman.Execute();

                if (pass == 1)
                {

                    this.homeResults = new List<LocalityResult>();
                    salesman.Result.ForEach(x => homeResults.Add(x));

                }
                else
                {

                    this.gpResults = new List<LocalityResult>();
                    salesman.Result.ForEach(x => gpResults.Add(x));
                    var resultsPanel = new ResultsPanel();
                    resultsPanel.SetResults(homeResults, gpResults, setup.SelectedLocalities);
                    AddResultsPanel("TSPResults", "TSP Results", resultsPanel);
                }
            }
        }
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var results = (List<ResultsContainer>)e.Result;

            foreach (var result in results)
            {
                var resultsPanel = new ResultsPanel();
                resultsPanel.SetResults(result.Home, result.GP, setups[0].SelectedLocalities);
                AddResultsPanel(result.PageName, result.Name, resultsPanel);
            }

            waitForm.Close();
        }
        private void DailyCentroidAnalysis()
        {
            int pass = 0;

            foreach (var setup in this.setups)
            {
                pass++;
                var patientResults = new List<LocalityResult>();

                var analyser = new CentroidDailyAnalysisMethod(setup);

                analyser.Execute();

                if (pass == 1)
                {

                    this.homeResults = new List<LocalityResult>();
                    analyser.Result.ForEach(x => homeResults.Add(x));

                }
                else
                {

                    this.gpResults = new List<LocalityResult>();
                    analyser.Result.ForEach(x => gpResults.Add(x));
                    var resultsPanel = new ResultsPanel();
                    resultsPanel.SetResults(homeResults, gpResults, setup.SelectedLocalities);
                    AddResultsPanel("DailyCentroidAnalysis", "Centroid Analysis - Daily", resultsPanel);
                }
            }
        }
        private void AddResultsPanel(string pageName, string pageText, ResultsPanel resultsPanel)
        {
            resultsPagesOpen++;
            var newPage = new TabPage("Results " + resultsPagesOpen + " - " + pageText);

            newPage.Location = new System.Drawing.Point(4, 22);
            newPage.Size = new System.Drawing.Size(1185, 569);
            newPage.TabIndex = 3;
            newPage.Name = "resultsTab" + resultsPagesOpen;
            newPage.UseVisualStyleBackColor = true;
            newPage.ImageIndex = 3;

            resultsPanel.Location = new System.Drawing.Point(3, 3);
            resultsPanel.Name = "resultsPanel_" + resultsPagesOpen;
            resultsPanel.ResultsDescription = "Results " + resultsPagesOpen + " - " + pageText;
            resultsPanel.Size = new System.Drawing.Size(1153, 525);
            resultsPanel.Anchor =  ((System.Windows.Forms.AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)))));

            resultsPanel.TabIndex = 0;

            AddContextMenuToTab(newPage);

            newPage.Controls.Add(resultsPanel);

            this.tabControl1.TabPages.Add(newPage);
            this.tabControl1.SelectedTab = newPage;
        }