public static SheetDataProcessor Build(SheetsService sheetsService, string spreadsheetId, IProgress <int> progress)
        {
            var processor = new SheetDataProcessor();

            processor._sheetsService = sheetsService;
            processor._spreadsheetId = spreadsheetId;

            processor.BuildTrainingDays(progress);

            if (File.Exists(Constants.CombosFileName))
            {
                processor.ReadAllCombos();
            }
            else
            {
                processor.BuildAllCombos();
            }
            progress.Report(70);

            processor.BuildAllExercises();
            progress.Report(80);

            processor.BuildDayMusclesLookup();
            progress.Report(90);

            processor.BuildMuscleExercisesLookup();
            progress.Report(100);

            return(processor);
        }
        private async void LoadBnt_Click(object sender, RoutedEventArgs e)
        {
            ToggleLoading();

            string sheetId = sheetIdInput.Text;

            IProgress <int> progress = new Progress <int>(percent => progressBar.Value = percent);

            //SheetDataProcessor.Build(await _gac.GetSheetsServiceAsync(), sheetId.ToString(), progress);
            try
            {
                _sdp = await Task.Factory.StartNew(async() =>
                {
                    progress.Report(10);

                    var sheetsService = await _gac.GetSheetsServiceAsync();
                    progress.Report(20);

                    return(SheetDataProcessor.Build(sheetsService, sheetId.ToString(), progress));
                })
                       .Unwrap();
            }
            catch (GoogleApiException)
            {
                ToggleLoading();
                progressBar.Value = 0;

                MessageBox.Show("Таблица с указанным ID не найдена", "Еггог", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            comboView.Init(_sdp);

            sheetNameInput.Text = _sdp.SheetTitle;

            _appData.LastOpenedSheetId   = sheetId;
            _appData.LastOpenedSheetName = _sdp.SheetTitle;
            _appData.Save();

            dayOfWeekCb.IsEnabled = true;
            dateTexBox.IsEnabled  = true;

            var today = DateTime.Now.Date;
            var todayDayOfWeekIndex   = (int)today.DayOfWeek;
            var nextTrainingDaysToAdd = todayDayOfWeekIndex > 5
                ? ((int)DayOfWeek.Monday - todayDayOfWeekIndex + 7) % 7
                : todayDayOfWeekIndex % 2 == 0 ? 1 : 0;
            var nextTrainingDay = today.AddDays(nextTrainingDaysToAdd);

            dateTexBox.Text          = nextTrainingDay.ToString("yyyy-MM-dd");
            dayOfWeekCb.SelectedItem = null;
            dayOfWeekCb.SelectedItem = _days.First(x => x.Value == nextTrainingDay.DayOfWeek);

            writeBtn.Visibility = Visibility.Visible;
            ToggleLoading();
            progressBar.Value = 0;
        }