Ejemplo n.º 1
0
        protected void btnFromDays_Click(object sender, RoutedEventArgs e)
        {
            this.LblLoading.Visibility = Visibility.Visible;
            if (selectedDateStart != null && selectedDateStop != null)
            {
                Task downloadTask = Task.Run(() =>
                {
                    DownloadFileFTP();
                    try
                    {
                        csvDataTable = CSV_DataTable.ConvertCSVtoDataTable(filePath);
                    }
                    catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); }

                    SeriesCollectionOperate seriesCollectionOperate = new SeriesCollectionOperate();
                    try
                    {
                        //_ = LoopTask(seriesCollectionOperate, arSeries.Length);
                        Dispatcher.Invoke(() => DrawChart(seriesCollectionOperate, arSeries.Length));
                    }
                    catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); }
                });
            }
            else
            {
                MessageBox.Show("Выберете дату начала и конца графика");
            }
        }
Ejemplo n.º 2
0
 private void DrawChart(SeriesCollectionOperate seriesCollectionOperate, int nomber)
 {
     this.LblLoading.Visibility = Visibility.Hidden;
     for (int i = 0; i < nomber; i++)
     {
         SetCollections(seriesCollectionOperate, i);
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }