Пример #1
0
 public PhrasesLangDetailViewModel(PhrasesLangViewModel vm, MLangPhrase item)
 {
     item.CopyProperties(ItemEdit);
     vmSinglePhrase = new SinglePhraseViewModel(item.PHRASE, vm.vmSettings);
     ItemEdit.Save  = ReactiveCommand.CreateFromTask(async() =>
     {
         ItemEdit.CopyProperties(item);
         item.PHRASE = vm.vmSettings.AutoCorrectInput(item.PHRASE);
         if (item.ID == 0)
         {
             await vm.Create(item);
         }
         else
         {
             await vm.Update(item);
         }
     }, ItemEdit.IsValid());
 }
Пример #2
0
 public PhrasesUnitDetailViewModel(PhrasesUnitViewModel vm, MUnitPhrase item, int wordid)
 {
     item.CopyProperties(ItemEdit);
     vmSinglePhrase = new SinglePhraseViewModel(item.PHRASE, vm.vmSettings);
     ItemEdit.Save  = ReactiveCommand.CreateFromTask(async() =>
     {
         ItemEdit.CopyProperties(item);
         item.PHRASE = vm.vmSettings.AutoCorrectInput(item.PHRASE);
         if (item.ID != 0)
         {
             await vm.Update(item);
         }
         else
         {
             await vm.Create(item);
             if (wordid != 0)
             {
                 await wordPhraseDS.Associate(wordid, item.PHRASEID);
             }
         }
     }, ItemEdit.IsValid());
 }