private void OnFeedEntity(FeedEntity obj) { var s = _sources.FirstOrDefault(v => obj.uri == v.Uri); if (s == null) return; if (obj.entries == null) return; s.AddUnreadCount(obj.entries.Length); }
internal async System.Threading.Tasks.Task<string> Load(string q) { //var rel = "/api/feed_source/show.json?q=" + Uri.EscapeDataString(q); //api/feed_source/find.json var uri = BackendService.Compile(ServiceLocator.BackendAddress(), BackendService.FeedSourceShow, new { q }); var v = await HttpClientUtils.Get<FeedEntity>(uri); if (v.code != 0) { MessengerInstance.Send(new BackendError { code = v.code, reason = v.reason }); return v.reason; } _ = v.data; Name = v.data.name; HasSubscribed = v.data.subscribe_state == FeedSourceSubscribeStates.Subscribed; foreach (var e in _.entries) { var c = e; await DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() => _entries.Add(new FeedEntryViewModel(c))), System.Windows.Threading.DispatcherPriority.ContextIdle); } return string.Empty; }
internal FeedSourceFindEntryViewModel(FeedEntity v) { _ = v; _has_subscribed = _.subscribe_state == FeedSourceSubscribeStates.Subscribed; _subscribe_self = new RelayCommand<bool>(ExecuteSubscribeSelf); }