コード例 #1
0
        /// <summary>
        /// Обработка исходоного файла. Загрузка в лейблы.
        /// </summary>
        /// <param name="source"></param>
        private async void ProcessSourceFile(SourceFile source)
        {
            _questionManager.SetSourceList(source);
            if (_settings.EnableLimit)
            {
                _questionManager.SetQuestionLimit(_settings.QuestionLimitCount);
            }
            //----------------------------
            _currentQuestion = _questionManager.GetNext();
            _count          += 1;
            LoadToLabels(_currentQuestion);
            var remain = !_settings.EnableLimit
                ? _questionManager.GetCount() - _answered.Count
                : _settings.QuestionLimitCount - _answered.Count;

            InformationLabel.Content = $"Осталось {remain} вопр.";
            LimitLabel.Content       = _settings.EnableLimit ? Const.LimitEnabled : Const.LimitDisabled;
            SwearLabel.Content       = _settings.ShowSwearing ? Const.SwearsEnabled : Const.SwearsDisabled;
            //
            var count = _questionManager.GetCount();

            if (count > 0)
            {
                serviceTextBox.Text   = $"Файл {source.FileName} загружен. Нажмите \"Начать\". Вопросов {count}";
                _loadedFile           = true;
                StartButton.IsEnabled = true;
            }
            else
            {
                serviceTextBox.Text = $"Возникли проблемы с обработкой вопросов";
            }
            //--------------------------
            NextButton.Content  = Const.NextQuestion;
            CheckButton.Content = Const.CheckQuestion;
            //UInterfaceHelper.SetProgressValue(progressBar, 100);

            var errors = _questionManager.GetErrors();

            if (errors != null)
            {
                new ErrorWindow(errors.ToList()).ShowDialog();
            }
        }