示例#1
0
        /// <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();
        }
示例#2
0
 public VocabViewModel()
     : base(NavigationPageEnum.Vocab)
 {
     _filter       = new VocabFilter();
     VocabListVm   = new VocabListViewModel(_filter);
     VocabFilterVm = new VocabFilterViewModel(_filter);
     VocabListVm.KanjiNavigated  += OnKanjiNavigation;
     VocabFilterVm.FilterChanged += OnFilterChanged;
 }
 public VocabViewModel()
     : base(NavigationPageEnum.Vocab)
 {
     _filter = new VocabFilter();
     VocabListVm = new VocabListViewModel(_filter);
     VocabFilterVm = new VocabFilterViewModel(_filter);
     VocabListVm.KanjiNavigated += OnKanjiNavigation;
     VocabFilterVm.FilterChanged += OnFilterChanged;
 }
        /// <summary>
        /// Builds a filter view model with the given filter.
        /// </summary>
        /// <param name="filter">Filter to use.</param>
        public VocabFilterViewModel(VocabFilter filter)
        {
            _filter = filter;

            CategoryFilterVm = new CategoryFilterViewModel();
            CategoryFilterVm.PropertyChanged += OnCategoryChanged;

            ApplyFilterCommand              = new RelayCommand(IssueFilterChangedEvent);
            ClearCategoryFilterCommand      = new RelayCommand(OnClearCategoryFilter);
            SwitchCommonOrderCommand        = new RelayCommand(OnSwitchCommonOrder);
            SwitchWritingLengthOrderCommand = new RelayCommand(OnSwitchWritingLengthOrder);
        }
示例#5
0
        /// <summary>
        /// Builds a filter view model with the given filter.
        /// </summary>
        /// <param name="filter">Filter to use.</param>
        public VocabFilterViewModel(VocabFilter filter)
        {
            _filter = filter;

            FilterChangedCommand            = new RelayCommand(IssueFilterChangedEvent);
            SendReadingFilterCommand        = new RelayCommand(OnSendReadingFilter);
            SendMeaningFilterCommand        = new RelayCommand(OnSendMeaningFilter);
            SendCategoryFilterCommand       = new RelayCommand(OnSendCategoryFilter);
            ClearCategoryFilterCommand      = new RelayCommand(OnClearCategoryFilter);
            SwitchCommonOrderCommand        = new RelayCommand(OnSwitchCommonOrder);
            SwitchWritingLengthOrderCommand = new RelayCommand(OnSwitchWritingLengthOrder);
        }
        protected override int GetItemCount()
        {
            if (!Filter.IsEmpty())
            {
                VocabFilter filter = (VocabFilter)_currentFilter;

                return((int)_vocabDao.GetFilteredVocabCount(filter.Kanji.FirstOrDefault(), filter.Vocab,
                                                            filter.ReadingString, filter.MeaningString,
                                                            filter.Category, filter.JlptLevel, filter.WkLevel));
            }

            return(0);
        }
 public VocabListViewModel(VocabFilter filter)
     : base(filter)
 {
     KanjiNavigationCommand  = new RelayCommand <KanjiWritingCharacter>(OnKanjiNavigation);
     AddToSrsCommand         = new RelayCommand <ExtendedVocab>(OnAddToSrs);
     QuickAddToSrsCommand    = new RelayCommand <ExtendedVocab>(OnQuickAddToSrs);
     AddSrsDelayCommand      = new RelayCommand <ExtendedVocab>(OnAddSrsDelay);
     SubtractSrsDelayCommand = new RelayCommand <ExtendedVocab>(OnSubtractSrsDelay);
     EditSrsEntryCommand     = new RelayCommand <ExtendedVocab>(OnEditSrsEntry);
     KanjiCopyCommand        = new RelayCommand <ExtendedVocab>(OnKanjiCopy);
     KanaCopyCommand         = new RelayCommand <ExtendedVocab>(OnKanaCopy);
     PlayAudioCommand        = new RelayCommand <ExtendedVocab>(OnPlayAudio);
     SwitchVocabCommand      = new RelayCommand <VocabVariant>(OnSwitchVocab);
 }
        protected override IEnumerable <VocabEntity> DoFilter()
        {
            if (!Filter.IsEmpty())
            {
                VocabFilter filter = (VocabFilter)_currentFilter;

                foreach (VocabEntity vocab in _vocabDao.GetFilteredVocab(
                             filter.Kanji.FirstOrDefault(), filter.Vocab,
                             filter.ReadingString, filter.MeaningString,
                             filter.Category, filter.JlptLevel, filter.WkLevel,
                             filter.IsCommonFirst, filter.IsShortReadingFirst))
                {
                    yield return(vocab);
                }
            }

            yield break;
        }
 /// <summary>
 /// Builds a filtered vocab list using the provided filter.
 /// </summary>
 /// <param name="filter">Vocab filter.</param>
 public FilteredVocabIterator(VocabFilter filter)
     : base(filter)
 {
     _vocabDao = new VocabDao();
 }
        /// <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 filter view model with the given filter.
        /// </summary>
        /// <param name="filter">Filter to use.</param>
        public VocabFilterViewModel(VocabFilter filter)
        {
            _filter = filter;

            SendReadingFilterCommand = new RelayCommand(OnSendReadingFilter);
            SendMeaningFilterCommand = new RelayCommand(OnSendMeaningFilter);
            SwitchCommonOrderCommand = new RelayCommand(OnSwitchCommonOrder);
            SwitchWritingLengthOrderCommand = new RelayCommand(OnSwitchWritingLengthOrder);
        }