Example #1
0
 public TextbooksViewModel(SettingsViewModel vmSettings, bool needCopy)
 {
     this.vmSettings = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     this.WhenAnyValue(x => x.Items).Subscribe(_ => this.RaisePropertyChanged(nameof(StatusText)));
     this.WhenAnyValue(x => x.SelectedTextbookItem, (MTextbook v) => v != null).ToPropertyEx(this, x => x.HasSelectedTextbookItem);
     Reload();
 }
Example #2
0
        public BlogViewModel(SettingsViewModel vmSettings, bool needCopy)
        {
            this.vmSettings = !needCopy ? vmSettings : vmSettings.ShallowCopy();

            HtmlToMarkedCommand = ReactiveCommand.Create(() =>
            {
                MarkedText = service.HtmlToMarked(HtmlText);
            });
            AddNotesCommand = ReactiveCommand.CreateFromTask(async() =>
            {
                MarkedText = await service.AddNotes(this.vmSettings, MarkedText);
            });
        }
Example #3
0
 public ReadNumberViewModel(SettingsViewModel vmSettings, bool needCopy)
 {
     this.vmSettings   = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     Type              = (ReadNumberType)this.vmSettings.USREADNUMBER;
     ReadNumberCommand = ReactiveCommand.Create(() =>
     {
         Text =
             Type == ReadNumberType.Japanese ? ReadNumberService.ReadInJapanese(Number) :
             Type == ReadNumberType.KoreanNative ? ReadNumberService.ReadInNativeKorean(Number) :
             Type == ReadNumberType.KoreanSino ? ReadNumberService.ReadInSinoKorean(Number) :
             "";
     });
 }
Example #4
0
 public PatternsWebPagesViewModel(SettingsViewModel vmSettings, bool needCopy, MPattern item)
 {
     this.vmSettings     = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     SelectedPatternItem = item;
     ReloadCommand       = ReactiveCommand.CreateFromTask(async() =>
     {
         IsBusy       = true;
         WebPageItems = new ObservableCollection <MPatternWebPage>(SelectedPatternItem == null ? new List <MPatternWebPage>() : await patternWebPageDS.GetDataByPattern(SelectedPatternItem.ID));
         this.RaisePropertyChanged(nameof(WebPageItems));
         SelectedWebPageItem = WebPageItems.FirstOrDefault();
         IsBusy = false;
     });
     GetWebPages().Subscribe();
 }
Example #5
0
 public PatternsViewModel(SettingsViewModel vmSettings, bool needCopy)
 {
     this.vmSettings = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     this.WhenAnyValue(x => x.TextFilter, x => x.ScopeFilter).Subscribe(_ => ApplyFilters());
     this.WhenAnyValue(x => x.PatternItems).Subscribe(_ => this.RaisePropertyChanged(nameof(StatusText)));
     this.WhenAnyValue(x => x.SelectedPatternItem, (MPattern v) => v != null).ToPropertyEx(this, x => x.HasSelectedPatternItem);
     ReloadCommand = ReactiveCommand.CreateFromTask(async() =>
     {
         IsBusy          = true;
         PatternItemsAll = new ObservableCollection <MPattern>(await patternDS.GetDataByLang(vmSettings.SelectedLang.ID));
         ApplyFilters();
         IsBusy = false;
     });
     Reload();
 }
 // https://stackoverflow.com/questions/15907356/how-to-initialize-an-object-using-async-await-pattern
 public PhrasesReviewViewModel(SettingsViewModel vmSettings, bool needCopy, Action doTestAction)
 {
     this.vmSettings = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     DoTestAction    = doTestAction;
 }
Example #7
0
 public DictsViewModel(SettingsViewModel vmSettings, bool needCopy)
 {
     this.vmSettings = !needCopy ? vmSettings : vmSettings.ShallowCopy();
     this.WhenAnyValue(x => x.Items).Subscribe(_ => this.RaisePropertyChanged(nameof(StatusText)));
     Reload();
 }