private void OnGetNewBlogOptionsCompleted(object sender, XMLRPCCompletedEventArgs <Option> args) { GetOptionsRPC rpc = sender as GetOptionsRPC; rpc.Completed -= OnGetNewBlogOptionsCompleted; 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("OnGetNewBlogOptionsCompleted: Exception occurred (" + newBlog.BlogName + ")"); this.DebugLog(args.Error.ToString()); NotifyExceptionOccurred(new ExceptionEventArgs(args.Error)); } else { newBlog.Options.Clear(); args.Items.ForEach(option => { newBlog.Options.Add(option); }); } this.DebugLog("Blog '" + newBlog.BlogName + "' has finished downloading Options."); if (newBlog == CurrentBlog) { NotifyFetchComplete(); } //get the pages for the new blog GetPageListRPC pageListRPC = new GetPageListRPC(newBlog); pageListRPC.Completed += OnGetNewBlogPagesCompleted; pageListRPC.ProgressChanged += OnGetNewBlogPagesProgressChanged; pageListRPC.ExecuteAsync(); }
private void OnFetchOptionsRPCCompleted(object sender, XMLRPCCompletedEventArgs <Option> args) { GetOptionsRPC rpc = sender as GetOptionsRPC; rpc.Completed -= OnFetchOptionsRPCCompleted; CurrentBlog.hideLoadingIndicator(); if (null == args.Error) { CurrentBlog.Options.Clear(); args.Items.ForEach(option => { CurrentBlog.Options.Add(option); }); NotifyFetchComplete(); //Notify here the end of the synch } else { NotifyExceptionOccurred(new ExceptionEventArgs(args.Error)); } }
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(); }