public void SetOnlineDict(IOnlineDict dict) { vmDict = new OnlineDictViewModel(vmSettings, dict); vmSettings.WhenAnyValue(x => x.SelectedDictReference).Where(v => v != null).Subscribe(async v => { vmDict.Dict = v; await vmDict.SearchDict(); }); this.WhenAnyValue(x => x.CurrentWordIndex).Subscribe(async v => { vmDict.Word = Words[CurrentWordIndex]; await vmDict.SearchDict(); }); }
public SearchViewModel(SettingsViewModel vmSettings, IOnlineDict dict) { this.vmSettings = vmSettings; vmDict = new OnlineDictViewModel(vmSettings, dict); vmSettings.WhenAnyValue(x => x.SelectedDictReference).Where(v => v != null).Subscribe(async v => { vmDict.Dict = v; await vmDict.SearchDict(); }); vmDict.WhenAnyValue(x => x.Word).Skip(1).Subscribe(async v => { await vmDict.SearchDict(); }); }