private async Task BuildFilesFillingDiagrams(CancellationToken cancellationToken) { System.Windows.Application.Current.Dispatcher.Invoke(() => { TobiiCSVFiles.Clear(); }); if (!Directory.Exists(DirectoryCSVFiles)) { MessageBox.Show("Директории " + DirectoryCSVFiles + " не существует"); return; } List <string> files = Directory.GetFiles(DirectoryCSVFiles, "*.csv", SearchOption.AllDirectories).ToList(); if (!Directory.Exists(DirectoryCSVFiles)) { MessageBox.Show("В директории и ее поддиректориях " + DirectoryCSVFiles + " нет csv-файлов"); return; } InfoMessage = "Обработка " + files.Count() + " файлов началась"; foreach (string fullfilepath in files) { if (cancellationToken.IsCancellationRequested) { Console.WriteLine("Операция прервана"); InfoMessage = "Операция прервана"; break; } TobiiCSVFile tobiiCSVFile = new TobiiCSVFile(fullfilepath, SmoothInterval); tobiiCSVFile.ReadTestingInfo(); System.Windows.Application.Current.Dispatcher.Invoke(() => { TobiiCSVFiles.Add(tobiiCSVFile); }); Console.WriteLine(fullfilepath); InfoMessage = "Файл " + (files.IndexOf(fullfilepath) + 1).ToString() + " из " + files.Count() + " обработан"; } InfoMessage = "Обработка " + files.Count() + " файлов завершена"; }
private void StackedAreaExampleRefresh(TobiiCSVFile selectedTobiiCSVFile) { XFormatter = val => val.ToString(); YFormatter = val => val.ToString(); XFormatter2 = val => TimeSpan.FromMilliseconds(val).ToString(@"mm\:ss"); List <ObservablePoint> xy_list = new List <ObservablePoint>(); foreach (var x in selectedTobiiCSVFile.Xs) { XY xy = new XY(); xy.X = x; xy.Y = selectedTobiiCSVFile.Ys[selectedTobiiCSVFile.Xs.IndexOf(x)]; xy_list.Add(new ObservablePoint(xy.X, xy.Y)); } //Brush brush = new SolidColorBrush(Colors.Gray); //brush.Opacity = 0.5; //SeriesCollection = new SeriesCollection //{ // new StackedAreaSeries // { // Values = new ChartValues<ObservablePoint> // { // }, // LineSmoothness = 0 , Foreground = Brushes.Black, Fill = brush, PointForeground=Brushes.Black // } //}; Brush brush2 = new SolidColorBrush(Colors.DarkOrange); brush2.Opacity = 0.5; SeriesCollection2 = new SeriesCollection { new StackedAreaSeries { Values = new ChartValues <ObservablePoint> { }, LineSmoothness = 0, Foreground = Brushes.Black, Fill = brush2, PointForeground = Brushes.Black } }; foreach (var xy in xy_list) { // SeriesCollection[0].Values.Add(xy); SeriesCollection2[0].Values.Add(xy); } OnPropertyChanged("SeriesCollection"); OnPropertyChanged("SeriesCollection2"); }