private void OnGetNewBlogPostFormatsCompleted(object sender, XMLRPCCompletedEventArgs <PostFormat> args) { GetPostFormatsRPC rpc = sender as GetPostFormatsRPC; rpc.Completed -= OnGetNewBlogPostFormatsCompleted; Blog newBlog = _trackedBlogs.Where(blog => blog.BlogId == rpc.BlogId).FirstOrDefault(); if (null == newBlog) { return; } //report the error, but keep trying to get data if (null != args.Error) { this.DebugLog("OnGetNewBlogPostFormatsCompleted: Exception occurred (" + newBlog.BlogName + ")"); this.DebugLog(args.Error.ToString()); NotifyExceptionOccurred(new ExceptionEventArgs(args.Error)); } else { newBlog.PostFormats.Clear(); args.Items.ForEach(postFormat => { newBlog.PostFormats.Add(postFormat); }); } this.DebugLog("Blog '" + newBlog.BlogName + "' has finished downloading postFormats."); if (newBlog == CurrentBlog) { NotifyFetchComplete(); } //get the options for the new blog GetOptionsRPC optionRPC = new GetOptionsRPC(newBlog); optionRPC.Completed += OnGetNewBlogOptionsCompleted; optionRPC.ExecuteAsync(); }
private void OnFetchPostFormatsRPCCompleted(object sender, XMLRPCCompletedEventArgs <PostFormat> args) { GetPostFormatsRPC rpc = sender as GetPostFormatsRPC; rpc.Completed -= OnFetchPostFormatsRPCCompleted; if (null == args.Error) { CurrentBlog.PostFormats.Clear(); args.Items.ForEach(postFormat => { CurrentBlog.PostFormats.Add(postFormat); }); // NotifyFetchComplete(); do not notify here } else { NotifyExceptionOccurred(new ExceptionEventArgs(args.Error)); } GetOptionsRPC rpcOption = new GetOptionsRPC(CurrentBlog); rpcOption.Completed += OnFetchOptionsRPCCompleted; rpcOption.ExecuteAsync(); }