private void OnGetApiKeyRPCCompleted(object sender, XMLRPCCompletedEventArgs <Blog> args) { //the blog is updated by the rpc. all we have to do here is unbind GetApiKeyRPC rpc = sender as GetApiKeyRPC; rpc.Completed -= OnGetApiKeyRPCCompleted; //check for empty args.Items, self-hosted blogs will return null here Blog newBlog; if (args.Items.Count == 0) { newBlog = rpc.blog; } else { newBlog = args.Items[0]; } _trackedBlogs.Add(newBlog); this.DebugLog("Blog '" + newBlog.BlogName + "' is now downloading data."); //start with the comments GetAllCommentsRPC getCommentsRPC = new GetAllCommentsRPC(newBlog); getCommentsRPC.Number = CHUNK_SIZE; getCommentsRPC.Offset = 0; getCommentsRPC.Completed += OnGetNewBlogCommentsCompleted; getCommentsRPC.ProgressChanged += OnGetCommentsRPCProgressChanged; getCommentsRPC.ExecuteAsync(); }
public void AddBlogToStore(Blog newBlog) { if (!(Blogs.Contains(newBlog))) { Blogs.Add(newBlog); } if (string.IsNullOrEmpty(newBlog.ApiKey)) { newBlog.showLoadingIndicator(); GetApiKeyRPC rpc = new GetApiKeyRPC(newBlog, false); rpc.Completed += OnGetApiKeyRPCCompleted; rpc.ExecuteAsync(); } }