private void button1_Click(object sender, EventArgs e) { int startAmount = (int)AmountMINNum.Value; int endAmount = (int)AmountMAXNum.Value; if (endAmount < startAmount) return; d_pSimulations.Clear(); d_pFreq.Clear(); d_pReportInfo.Clear(); d_ChartLimits.Clear(); iSim = 0; double range = (double)RangeNum.Value; for (int i = startAmount; i <= endAmount; i+=10) { var simData = simulator2000.Simulate((int)DaysNum.Value, (double)BuyPriceNum.Value, (double)SalePriceNum.Value, (double)ScrapPriceNum.Value, (int)i); Dictionary<double, int> freq = new Dictionary<double, int>(); BindingList<SimulationInfo> element_list = new BindingList<SimulationInfo>(); foreach (var element in simData) { element_list.Add(element); double rv = Round(range, element.daily_profit); if (!freq.ContainsKey(rv)) { freq.Add(rv, 1); } else { freq[rv]++; } } d_pSimulations.Add(element_list); d_pFreq.Add(freq); ReportInfo report = new ReportInfo() { TotalSalRevenue = simulator2000.TotalSaleRevenue, TotalNewsCost = simulator2000.TotalNewsCost, TotalLostProfit = simulator2000.TotalLostProfit, TotalScrapRevenue = simulator2000.TotalScrapRevenue, TotalNetProfit = simulator2000.TotalNetProfit, TotalDaysExcess = simulator2000.TotalDaysExcess, TotalDaysUnsold = simulator2000.TotalDaysUnsold }; d_pReportInfo.Add(report); d_ChartLimits.Add(new Tuple<double, double>(simulator2000.MinimumProfit, simulator2000.MaximumProfit)); } viewData(); }