Example #1
0
        public async Task Create(MLangWord item)
        {
            await langWordDS.Create(item);

            WordItemsAll.Add(item);
            ApplyFilters();
        }
Example #2
0
        public async Task Create(MUnitWord item)
        {
            int id = await unitWordDS.Create(item);

            var o = await unitWordDS.GetDataById(id, vmSettings.Textbooks);

            o?.CopyProperties(item);
            if (item.NOTE.IsEmpty())
            {
                await RetrieveNote(item);
            }
            WordItemsAll.Add(o);
            ApplyFilters();
        }
Example #3
0
        public MUnitWord NewUnitWord()
        {
            var maxElem = WordItemsAll.IsEmpty() ? null : WordItemsAll.MaxBy(o => (o.UNIT, o.PART, o.SEQNUM)).First();

            return(new MUnitWord
            {
                LANGID = vmSettings.SelectedLang.ID,
                TEXTBOOKID = vmSettings.USTEXTBOOK,
                UNIT = maxElem?.UNIT ?? vmSettings.USUNITTO,
                PART = maxElem?.PART ?? vmSettings.USPARTTO,
                SEQNUM = (maxElem?.SEQNUM ?? 0) + 1,
                Textbook = vmSettings.SelectedTextbook,
            });
        }
Example #4
0
 void ApplyFilters()
 {
     WordItems = NoFilter ? WordItemsAll : new ObservableCollection <MUnitWord>(WordItemsAll.Where(o =>
                                                                                                   (string.IsNullOrEmpty(TextFilter) || (ScopeFilter == "Word" ? o.WORD : o.NOTE).ToLower().Contains(TextFilter.ToLower())) &&
                                                                                                   (TextbookFilter == 0 || o.TEXTBOOKID == TextbookFilter)
                                                                                                   ));
     this.RaisePropertyChanged(nameof(WordItems));
 }
Example #5
0
 protected virtual void ApplyFilters()
 {
     WordItems = string.IsNullOrEmpty(TextFilter) ? WordItemsAll : new ObservableCollection <MLangWord>(WordItemsAll.Where(o =>
                                                                                                                           string.IsNullOrEmpty(TextFilter) || (ScopeFilter == "Word" ? o.WORD : o.NOTE).ToLower().Contains(TextFilter.ToLower())
                                                                                                                           ));
     this.RaisePropertyChanged(nameof(WordItems));
 }