/// <summary>
        /// Builds a kanji details ViewModel handling the given kanji.
        /// </summary>
        /// <param name="kanjiEntity">Kanji to handle.</param>
        public KanjiDetailsViewModel(ExtendedKanji kanjiEntity)
        {
            KanjiEntity = kanjiEntity;

            if (KanjiEntity.DbKanji.SrsEntries.Any())
            {
                SrsEntry = new ExtendedSrsEntry(
                    KanjiEntity.DbKanji.SrsEntries.First());
            }

            VocabFilter filter = new VocabFilter() {
                Kanji = new KanjiEntity[] { _kanjiEntity.DbKanji } };

            VocabListVm = new VocabListViewModel(filter);
            VocabListVm.KanjiNavigated += OnKanjiNavigated;
            VocabFilterVm = new VocabFilterViewModel(filter);
            VocabFilterVm.FilterChanged += OnVocabFilterChanged;

            ToggleDetailsCommand = new RelayCommand(OnToggleDetails);
            AddToSrsCommand = new RelayCommand(OnAddToSrs);
            EditSrsEntryCommand = new RelayCommand(OnEditSrsEntry);
            FilterReadingCommand = new RelayCommand<string>(OnFilterReading);

            NextStrokeCommand = new RelayCommand(OnNextStroke);
            PreviousStrokeCommand = new RelayCommand(OnPreviousStroke);
            LastStrokeCommand = new RelayCommand(OnLastStroke);
            FirstStrokeCommand = new RelayCommand(OnFirstStroke);
            WaniKaniCommand = new RelayCommand(OnWaniKani);

            PrepareSvg();
        }
        /// <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);
        }
 public ExtendedVocab(VocabEntity dbVocab, ExtendedSrsEntry srsEntry)
 {
     DbVocab = dbVocab;
     Audio = new VocabAudio(dbVocab);
     SrsEntry = srsEntry;
 }
Example #4
0
 public ExtendedVocab(VocabEntity dbVocab, ExtendedSrsEntry srsEntry)
 {
     DbVocab  = dbVocab;
     Audio    = new VocabAudio(dbVocab);
     SrsEntry = srsEntry;
 }
 public SrsEntryEditedEventArgs(ExtendedSrsEntry srsEntry, bool isSaved)
 {
     SrsEntry = srsEntry;
     IsSaved = isSaved;
 }
 public SrsEntryEditedEventArgs(ExtendedSrsEntry srsEntry, bool isSaved)
 {
     SrsEntry = srsEntry;
     IsSaved  = isSaved;
 }