コード例 #1
0
        /// <summary>
        /// Builds the ViewModel.
        /// </summary>
        public SrsReviewViewModel()
        {
            _canSubmit = true;
            _random = new Random();
            _iterator = new FilteredSrsEntryIterator();
            _srsEntryDao = new SrsEntryDao();

            SubmitCommand = new RelayCommand(OnSubmit);
            AddAnswerCommand = new RelayCommand(OnAddAnswer);
            IgnoreAnswerCommand = new RelayCommand(OnIgnoreAnswer);
            EditSrsEntryCommand = new RelayCommand(OnEditSrsEntry);
            StopSessionCommand = new RelayCommand(OnStopSession);
            IgnoreAnswerShortcutCommand = new RelayCommand(OnIgnoreAnswerShortcut);
            AddAnswerShortcutCommand = new RelayCommand(OnAddAnswerShortcut);
        }
コード例 #2
0
        /// <summary>
        /// Builds the instance.
        /// </summary>
        private SrsBusiness()
        {
            _isUpdateAllowed = true;

            _srsEntryDao = new SrsEntryDao();
            _updateTimer = new DispatcherTimer();
            _updateTimer.Interval = UpdateReviewsCountDelay;
            _updateTimer.Tick += OnReviewsCountTimerTick;

            _minimalIntervalTimer = new DispatcherTimer();
            _minimalIntervalTimer.Interval = MinimalIntervalDelay;
            _minimalIntervalTimer.Tick += OnMinimalIntervalTimerTick;

            _updateTimer.Start();
            UpdateReviewInfoAsync();
        }
コード例 #3
0
 public ImportProgressViewModel(ImportModeViewModel parentMode)
     : base(parentMode)
 {
     _srsDao = new SrsEntryDao();
 }
コード例 #4
0
        /// <summary>
        /// Builds a ViewModel aimed at editing an existing SrsEntry,
        /// or adding a pre-composed SrsEntry.
        /// </summary>
        /// <param name="entity">Entity to edit.</param>
        public SrsEntryViewModel(SrsEntry entity)
        {
            // Initialize fields.
            _entry = new ExtendedSrsEntry(entity);
            _originalNextReviewDate = entity.NextAnswerDate;
            _originalLevelValue = entity.CurrentGrade;
            _associatedKanjiString = Entry.AssociatedKanji;
            _associatedVocabString = Entry.AssociatedVocab;
            _srsEntryDao = new SrsEntryDao();
            _kanjiDao = new KanjiDao();
            _vocabDao = new VocabDao();
            if (IsNew)
            {
                Entry.Tags = Properties.Settings.Default.LastSrsTagsValue;
            }

            // Create the relay commands.
            SubmitCommand = new RelayCommand(OnSubmit);
            CancelCommand = new RelayCommand(OnCancel);
            SrsProgressResetCommand = new RelayCommand(OnSrsProgressReset);
            ApplyAssociatedKanjiCommand = new RelayCommand(OnApplyAssociatedKanji);
            ApplyAssociatedVocabCommand = new RelayCommand(OnApplyAssociatedVocab);
            ToggleSuspendCommand = new RelayCommand(OnToggleSuspend);
            DeleteCommand = new RelayCommand(OnDelete);
            ToggleDateEditCommand = new RelayCommand(OnToggleDateEdit);
            DateToNowCommand = new RelayCommand(OnDateToNow);
            DateToNeverCommand = new RelayCommand(OnDateToNever);

            // Get the associated kanji or vocab.
            GetAssociatedKanji();
            GetAssociatedVocab();

            // Initialize the VM.
            _isFirstSrsLevelSelect = true;
            SrsLevelPickerVm = new SrsLevelPickerViewModel();
            SrsLevelPickerVm.SrsLevelSelected += OnSrsLevelSelected;
            SrsLevelPickerVm.Initialize(_entry.CurrentGrade);
        }