public void UpdatePosts() { if (this._updateTask != null) { this._updateTask.Cancel(); } // load posts from the network string postsUrl = this._urlBuilder.BuildPostsUrl(this.BoardName, this.ThreadNumber); this._updateTask = new HttpGetJsonTask<PostListModel>(postsUrl, this.OnPostsLoadedAfterUpdate); this._updateTask.OnError = this.ShowErrorAfterUpdate; this._updateTask.OnProgressChanged = val => this.ProgressAfterUpdate = val; this.IsLoadingAfterUpdate = true; this._updateTask.Execute(); }
public void Load(string boardName, string threadNumber) { if (this._currentTask != null) { this._currentTask.Cancel(); } this.BoardName = boardName; this.ThreadNumber = threadNumber; this.Title = "/" + boardName + "/" + threadNumber; // load posts from the network string postsUrl = this._urlBuilder.BuildPostsUrl(boardName, threadNumber); this._currentTask = new HttpGetJsonTask<PostListModel>(postsUrl, this.OnPostsLoaded); this._currentTask.OnError = this.ShowError; this._currentTask.OnProgressChanged = this.UpdateProgress; this.ShowLoading(); this._currentTask.Execute(); }
public void Load(string boardName, int page) { if (this._currentTask != null) { this._currentTask.Cancel(); } this.BoardName = boardName; this.Page = page; this.Title = string.Format("/{0}/{1}", boardName, page != 0 ? page.ToString() : string.Empty); // load threads from the network string threadsUrl = this._urlBuilder.BuildThreadsUrl(boardName, page); this._currentTask = new HttpGetJsonTask<ThreadListModel>(threadsUrl, this.OnThreadsLoaded); this._currentTask.OnError = this.ShowError; this._currentTask.OnProgressChanged = this.UpdateProgress; this.ShowLoading(); this._currentTask.Execute(); }
public override void ShowError(string message) { base.ShowError(message); this._currentTask = null; }
private void OnPostsLoadedAfterUpdate(PostListModel responseObject) { this.AddPosts(responseObject); this.IsLoadingAfterUpdate = false; this._updateTask = null; }
private void OnPostsLoaded(PostListModel responseObject) { this.AddPosts(responseObject); this.HideLoading(); this._currentTask = null; }
private void ShowErrorAfterUpdate(string message) { MessageBox.Show(message); this.IsLoadingAfterUpdate = false; this._updateTask = null; }
private void OnThreadsLoaded(ThreadListModel responseObject) { this.DisplayThreads(responseObject); this.HideLoading(); this._currentTask = null; }