Beispiel #1
0
        private void ViewResults(Simulation simulation)
        {
            ResultViewerFormNew resultsForm = ResultViewForms.AddAndReturn(new ResultViewerFormNew());

            resultsForm.LoadSimulation(simulation);
            resultsForm.FormClosed += (s, e) => ResultViewForms.Remove(resultsForm);
            resultsForm.Show();
        }
Beispiel #2
0
        private void InitializeResultsControls()
        {
            //
            // View results button
            //
            btnViewResultsChart.Enabled     = false;
            this.SelectedSimulationChanged += (s, e) =>
            {
                btnViewResultsChart.Enabled = (SelectedSimulation == null) ? false
                : (SelectedSimulation.SimulationStatus == SimulationStatus.Complete);
            };
            SimulationManager.Instance.SimulationStatusChanged += (s, e) =>
            {
                this.Invoke(new Action(() =>
                {
                    if (SelectedSimulation?.SimulationStatus == SimulationStatus.Complete)
                    {
                        btnViewResultsChart.Enabled = true;
                    }
                }));
            };
            btnViewResultsChart.Click += (s, e) =>
            {
                if (SelectedSimulation == null)
                {
                    return;
                }

                ResultViewerFormNew simResultViewer = new ResultViewerFormNew();
                simResultViewer.LoadSimulation(SelectedSimulation);
                simResultViewer.Show();
            };

            //
            // Equity chart
            //
            chartEquityResultView = new TinyFinanceSimResultsChart()
            {
                Dock = DockStyle.Fill
            };
            pnlTinyChart.Controls.Add(chartEquityResultView);

            this.SelectedSimulationChanged += (s, e) =>
            {
                if (SelectedSimulation?.SimulationStatus == SimulationStatus.Complete)
                {
                    chartEquityResultView.LoadSimulation(SelectedSimulation);
                    chartEquityResultView.Show();
                }
                else
                {
                    chartEquityResultView.Hide();
                }
            };
            SimulationManager.Instance.SimulationStatusChanged += (s, e) =>
            {
                Invoke(new Action(() =>
                {
                    if (SelectedSimulation?.SimulationStatus == SimulationStatus.Complete)
                    {
                        chartEquityResultView.LoadSimulation(SelectedSimulation);
                        chartEquityResultView.Show();
                    }
                    else
                    {
                        chartEquityResultView.Hide();
                    }
                }));
            };

            //
            // Sector chart
            //
            chartSectorResultView = new TinySectorResultsChart()
            {
                Dock = DockStyle.Fill
            };
            pnlSectorResultsChart.Controls.Add(chartSectorResultView);

            this.SelectedSimulationChanged += (s, e) =>
            {
                if (SelectedSimulation?.SimulationStatus == SimulationStatus.Complete)
                {
                    chartSectorResultView.LoadSimulation(SelectedSimulation);
                    chartSectorResultView.Show();
                }
                else
                {
                    chartSectorResultView.Hide();
                }
            };
            SimulationManager.Instance.SimulationStatusChanged += (s, e) =>
            {
                Invoke(new Action(() =>
                {
                    if (SelectedSimulation?.SimulationStatus == SimulationStatus.Complete)
                    {
                        chartSectorResultView.LoadSimulation(SelectedSimulation);
                        chartSectorResultView.Show();
                    }
                    else
                    {
                        chartSectorResultView.Hide();
                    }
                }));
            };
        }