Пример #1
0
        public void FetchBlogs()
        {
            this.SelectedAPIBlog = null;
            try
            {
                var proxy = XmlRpcProxyGen.Create <IMetaWeblog>();
                ((IXmlRpcProxy)proxy).Url = CurrentBlog.WebAPI;

                var blogs = proxy.GetUsersBlogs("MarkPad", CurrentBlog.Username, CurrentBlog.Password);

                this.APIBlogs = new ObservableCollection <FetchedBlogInfo>();

                foreach (var blogInfo in blogs)
                {
                    this.APIBlogs.Add(new FetchedBlogInfo {
                        Name = blogInfo.blogName, BlogInfo = blogInfo
                    });
                }
            }
            catch (WebException ex)
            {
                dialogService.ShowError("Fetch Failed", ex.Message, "");
            }
            catch (XmlRpcException ex)
            {
                dialogService.ShowError("Fetch Failed", ex.Message, "");
            }
            catch (XmlRpcFaultException ex)
            {
                dialogService.ShowError("Fetch Failed", ex.Message, "");
            }
        }
        public void FetchBlogs()
        {
            SelectedAPIBlog = null;

            var proxy = new MetaWeblog(CurrentBlog.WebAPI);

            APIBlogs = new ObservableCollection <FetchedBlogInfo>();

            proxy
            .GetUsersBlogsAsync("MarkPad", CurrentBlog.Username, CurrentBlog.Password)
            .ContinueWith(UpdateBlogList, TaskScheduler.FromCurrentSynchronizationContext())
            .ContinueWith(HandleFetchError);
        }