private async Task LoopTask(SeriesCollectionOperate seriesCollectionOperate, int nomber) { List <Task> tasks = new List <Task>(); for (int i = 0; i < nomber; i++) { tasks.Add(SetCollections(seriesCollectionOperate, i)); } await Task.WhenAll(tasks); }
protected void btnFromDays_Click(object sender, RoutedEventArgs e) { try { csvDataTable = CSV_DataTable.ConvertCSVtoDataTable(filePath); } catch (Exception ex) { } SeriesCollectionOperate seriesCollectionOperate = new SeriesCollectionOperate(); try { _ = LoopTask(seriesCollectionOperate, arSeries.Length); } catch (Exception ex) { /*System.Windows.MessageBox.Show(ex.Message);*/ } //DownloadFileFTP(); }
private Task SetCollections(SeriesCollectionOperate seriesCollectionOperate, int i) { Labels = seriesCollectionOperate.SetValues(SeriesCollection[i].Values, csvDataTable, 1, 2, arSeries[i].Column, (System.DateTime)pickedData.SelectedDate, (System.DateTime)PickerDataStop.SelectedDate, comboBoxHourStart.SelectedIndex, comboBoxHourEnd.SelectedIndex, comboBoxMinuteStart.SelectedIndex, comboBoxMinuteEnd.SelectedIndex); KeyValuePair <System.DateTime, double> maxValue = new KeyValuePair <DateTime, double>(); maxValue = seriesCollectionOperate.GetMax(); textBoxes[i].Text = "Max: [" + maxValue.Key.ToString() + "] " + maxValue.Value.ToString(); KeyValuePair <System.DateTime, double> minValue = new KeyValuePair <DateTime, double>(); minValue = seriesCollectionOperate.GetMin(); textBoxesMin[i].Text = "Min: [" + minValue.Key.ToString() + "] " + minValue.Value.ToString(); return(Task.CompletedTask); }
protected void btnFromDays_Click(object sender, RoutedEventArgs e) { try { csvDataTable = CSV_DataTable.ConvertCSVtoDataTable(filePath); } catch (Exception ex) { } SeriesCollectionOperate seriesCollectionOperate = new SeriesCollectionOperate(); try { for (int i = 0; i < series.Length; i++) { Labels = seriesCollectionOperate.SetValues(SeriesCollection[i].Values, csvDataTable, 1, 2, series[i].Column, (System.DateTime)pickedData.SelectedDate, (System.DateTime)PickerDataStop.SelectedDate, comboBoxHourStart.SelectedIndex, comboBoxHourEnd.SelectedIndex, comboBoxMinuteStart.SelectedIndex, comboBoxMinuteEnd.SelectedIndex); } } catch (Exception ex) { System.Windows.MessageBox.Show("Укажите время и дату начала и конца графика"); } }