//TODO: Сделать асинхронное чтение
        //TODO: Сделать окно с сообщением о загрузке
        /// <summary>
        /// Событие клика на начальную кнопку
        /// </summary>
        private void OpenFile()
        {
            ReadFileResult readFileResult = OpenAndReadFile();

            if (!readFileResult.IsSuccess)
            {
                MessageBox.Show(readFileResult.ErrorMessage);
                return;
            }

            CreateStatisticResult statisticResult = CreateStatisticResult.GetStatistic(
                readFileResult.MeasureDates,
                readFileResult.MeasureWindTypes,
                readFileResult.FirstInformationRow, readFileResult.SecondInformationRow, readFileResult.ThirdInformationRow);

            //TODO: Проверить на нормальность использования string заместо WindTypes
            IList <string> windTypes   = statisticResult.FileInformation.WindTypes.Select(_ => _.ToString()).ToList();
            IList <double> windChanges = WindChange.GetWindChangesValues(statisticResult.FileInformation.WindChanges);

            _mainWindowViewModel.AnalyzeCenterPage = new AnalyzeCenterPage(windTypes, windChanges);
            _mainWindowViewModel.CurrentCenterPage = _mainWindowViewModel.AnalyzeCenterPage;

            _mainWindowViewModel.MenuRightPage    = new MenuRightPage(statisticResult.FileInformation.FileInformationLabels);
            _mainWindowViewModel.CurrentRightPage = _mainWindowViewModel.MenuRightPage;

            _mainWindowViewModel.PeriodsLeftPage = new PeriodsLeftPage(statisticResult.FileInformation, statisticResult.PeriodInformations);
            _mainWindowViewModel.CurrentLeftPage = _mainWindowViewModel.PeriodsLeftPage;
        }
        private void ToggleValuesAndInfo(string year)
        {
            PeriodInformation  currentPeriodInfo = _periodInformations.FirstOrDefault(_ => _.Year.ToString().Equals(year));
            IList <WindChange> windChanges       = currentPeriodInfo.PeriodWindChanges;
            IList <double>     currentValues     = WindChange.GetWindChangesValues(windChanges);

            MainWindowViewModel mainViewModel = MainWindowViewModel.GetInstance();

            mainViewModel.AnalyzeCenterPage.SetWindValues(currentValues);
            mainViewModel.MenuRightPage.ChangeInformationLabel(currentPeriodInfo?.PeriodInformationLabels);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Метод для получения статистики
        /// </summary>
        private IList <WindChange> GetWindChanges()
        {
            int windsCount = Winds.Count() - 1;
            IList <WindChange> windChanges = new List <WindChange>(windsCount);

            for (int i = 0; i < windsCount; i++)
            {
                Wind       currentWind = Winds.ElementAt(i);
                Wind       nextWind    = Winds.ElementAt(i + 1);
                WindChange windChange  = new WindChange(currentWind, nextWind);

                windChanges.Add(windChange);
            }
            return(windChanges);
        }
Ejemplo n.º 4
0
        private void OpenFile()
        {
            ReadFileResult readResult = GetReadResult();

            if (!readResult.IsSuccess)
            {
                MessageBox.Show(readResult.ErrorMessage);
                return;
            }

            CreateStatisticResult statisticResult = CreateStatisticResult.GetStatistic(
                readResult.MeasureDates, readResult.MeasureWindTypes, readResult.FirstInformationRow,
                readResult.SecondInformationRow, readResult.ThirdInformationRow);

            IList <string> windTypes   = statisticResult.FileInformation.WindTypes.Select(_ => _.ToString()).ToList();
            IList <double> windChanges = WindChange.GetWindChangesValues(statisticResult.FileInformation.WindChanges);

            MainWindowViewModel mainViewModel = MainWindowViewModel.GetInstance();

            mainViewModel.AnalyzeCenterPage.SetWindHeaders(windTypes);
            mainViewModel.AnalyzeCenterPage.SetWindValues(windChanges);
            mainViewModel.PeriodsLeftPage.SetInformations(fileInformation: statisticResult.FileInformation, periodInformation: statisticResult.PeriodInformations);
        }