public UserFavoritesViewModel(UserInfoViewModel parent) { this._parent = parent; this._timelineModel = new TimelineModel( s => s.User.Id == parent.User.User.Id, (id, c, _) => { var info = AccountsStore.Accounts .Shuffle() .Select(s => s.AuthenticateInfo) .FirstOrDefault(); if (info == null) { return Observable.Empty<TwitterStatus>(); } return info.GetFavorites(this._parent.User.User.Id, max_id: id, count: c) .OrderByDescending(s => s.CreatedAt) .Catch((Exception ex) => { BackstageModel.RegisterEvent(new OperationFailedEvent(ex.Message)); return Observable.Empty<TwitterStatus>(); }); }); IsLoading = true; _timelineModel.ReadMore(null) .Finally(() => IsLoading = false) .Subscribe(); }
public SearchResultViewModel(SearchFlipViewModel parent, string query, SearchOption option) { this._parent = parent; _query = query; _option = option; _timelineModel = new TimelineModel( _predicate = CreatePredicate(query, option), (id, c, _) => Fetch(id, c)); IsLoading = true; _timelineModel.ReadMore(null) .Finally(() => IsLoading = false) .Subscribe(); MainAreaViewModel.TimelineActionTargetOverride = this; }