public void run(object item) { Download_Data_Info inf = item as Download_Data_Info; //Trend_Analyser_Connector.Trend_Analyser_Module_2_Download_Data(inf.symbol, inf.fYear, inf.fMonth, inf.fDay, inf.tYear, inf.tMonth, inf.tDay); if (UpdateEvent != null) { UpdateEvent.Invoke(); } Interlocked.Increment(ref i); if (i == count) { prog.Close(); if (CompletedEvent != null) { CompletedEvent.Invoke(); } } else { prog.setPercentage(i * 100 / count); } }
private void button2_Click(object sender, EventArgs e) { MessageBox.Show("Ignoring all invalid or inavailable symbols"); List <Download_Data_Info> info_list = new List <Download_Data_Info>(); foreach (var item in symbolsList.Items) { DateTime f = fromDate.Value; DateTime t = toDate.Value; Download_Data_Info info = new Download_Data_Info(); info.symbol = item.ToString(); info.item = item.ToString(); info.fYear = f.Year.ToString(); info.fMonth = f.Month.ToString(); info.fDay = f.Day.ToString(); info.tYear = t.Year.ToString(); info.tMonth = t.Month.ToString(); info.tDay = t.Day.ToString(); info_list.Add(info); } Request_Multiple_Download_With_Progress downloader = new Request_Multiple_Download_With_Progress(info_list); downloader.UpdateEvent += update_view_after_download; }