public List <ViewProgressBar> ListOfProgressBars() { List <ViewProgressBar> ListOfBars = new List <ViewProgressBar>(); ViewProgressBar bar1 = new ViewProgressBar(870, 386, 48, "Months"); ListOfBars.Add(bar1); ViewProgressBar bar2 = new ViewProgressBar(749, 386, 47, "Weeks"); ListOfBars.Add(bar2); ViewProgressBar bar3 = new ViewProgressBar(628, 386, 46, "DayStocks"); ListOfBars.Add(bar3); ViewProgressBar bar4 = new ViewProgressBar(507, 386, 45, "FourHours"); ListOfBars.Add(bar4); ViewProgressBar bar5 = new ViewProgressBar(386, 386, 44, "Hours"); ListOfBars.Add(bar5); ViewProgressBar bar6 = new ViewProgressBar(265, 386, 43, "HalfHours"); ListOfBars.Add(bar6); ViewProgressBar bar7 = new ViewProgressBar(144, 386, 42, "15min"); ListOfBars.Add(bar7); ViewProgressBar bar8 = new ViewProgressBar(23, 386, 20, "5min"); ListOfBars.Add(bar8); return(ListOfBars); }
private void ControllerStock_Load(object sender, EventArgs e) { ViewProgressBar viewProgressBar = new ViewProgressBar(); var listofbars = viewProgressBar.ListOfProgressBars(); foreach (var i in listofbars) { Controls.Add(i.progressBar); if (i.progressBar.Name == "Hours") { Task.Run(() => i.ProgressBar(60, "Hours", collectionSymbols)); } else if (i.progressBar.Name == "FourHours") { Task.Run(() => i.ProgressBar(24, "FourHours", collectionSymbols)); } else if (i.progressBar.Name == "HalfHours") { Task.Run(() => i.ProgressBar(60, "HalfHours", collectionSymbols)); } else if (i.progressBar.Name == "DayStocks") { Task.Run(() => i.ProgressBar(24, "DayStocks", collectionSymbols)); } else if (i.progressBar.Name == "Months") { Task.Run(() => i.ProgressBar(30, "Months", collectionSymbols)); } else if (i.progressBar.Name == "15min") { Task.Run(() => i.ProgressBar(60, "15min", collectionSymbols)); } else if (i.progressBar.Name == "5min") { Task.Run(() => i.ProgressBar(60, "5min", collectionSymbols)); } else if (i.progressBar.Name == "Weeks") { Task.Run(() => i.ProgressBar(60, "Weeks", collectionSymbols)); } } }