Exemplo n.º 1
0
 private void InitializeFeed(ForumsIndexFeed feed)
 {
     this.feed = feed;
     this.feed.SubscribeAsync(OnNext, OnError, OnCompleted);
 }
Exemplo n.º 2
0
 public ForumsIndexGroup(ForumsIndexFeed feed, PinnedForumsGroup pinned) : this() {
     this.createFeed = () => feed;
 }
Exemplo n.º 3
0
 protected override async Task OnSelectedAsyncCore(object state, IProgress<string> progress)
 {
     if (!this.IsBusy && this.Items.Count == 0)
         await LoadAsync(() =>
         {
             if (this.feed == null)
             {
                 ReportProgress(progress, "Creating forums index feed...");
                 this.feed = this.createFeed();
                 this.InitializeFeed(feed);
             }
             return this.feed.UpdateAsync();
         }, progress);
     else
     {
         SetOnItemsReady(true);
     }
 }
Exemplo n.º 4
0
 protected override async Task OnRefreshAsyncCore(object state, IProgress<string> progress)
 {
     if (!this.IsBusy)
         await this.LoadAsync(() =>
             {
                 if (this.feed == null)
                 {
                     ReportProgress(progress, "Creating forums index feed...");
                     this.feed = this.createFeed();
                     this.InitializeFeed(feed);
                 }
                 ReportProgress(progress, "Refreshing forums index...");
                 return this.feed.PullAsync();
             }, progress);
 }
Exemplo n.º 5
0
        private async Task LoadAsync(Func<Task> requestAsync, IProgress<string> progress)
        {
            this.IsBusy = true;
           
            // detach listener to pin changes
            ThreadDataGroup.PinChanged -= ThreadDataGroup_PinChanged;
            ReportProgress(progress, "Loading forums...");

            if (this.feed == null)
            {
                ReportProgress(progress, "Creating forums index feed...");
                this.feed = this.createFeed();
                this.InitializeFeed(feed);
            }
            
            await requestAsync();
            this.IsBusy = false;
            ReportProgress(progress, null);
        }