protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (this.NavigationContext.QueryString.TryGetValue("blog_id", out blog_id) && this.NavigationContext.QueryString.TryGetValue("comment_id", out comment_id)) { List <Blog> blogs = DataService.Current.Blogs.ToList(); foreach (Blog currentBlog in blogs) { if (currentBlog.isWPcom() || currentBlog.hasJetpack()) { string currentBlogID = currentBlog.isWPcom() ? Convert.ToString(currentBlog.BlogId) : currentBlog.getJetpackClientID(); if (currentBlogID == blog_id) { BlogName.Text = currentBlog.BlogName; _currentBlog = currentBlog; } } } } if (_currentBlog == null) { if (NavigationService.CanGoBack) { NavigationService.GoBack(); } return; } GetAllCommentsRPC rpc = new GetAllCommentsRPC(_currentBlog); rpc.Number = 20; rpc.Offset = 0; rpc.Completed += OnFetchCurrentBlogCommentsCompleted; rpc.ExecuteAsync(); UIThread.Invoke(() => { ApplicationBar.IsVisible = false; App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.Loading); }); }
private void OnFetchCurrentBlogCommentsCompleted(object sender, XMLRPCCompletedEventArgs <Comment> args) { GetAllCommentsRPC rpc = sender as GetAllCommentsRPC; rpc.Completed -= OnFetchCurrentBlogCommentsCompleted; UIThread.Invoke(() => { ApplicationBar.IsVisible = true; App.WaitIndicationService.HideIndicator(); }); if (null == args.Error) { foreach (Comment comment in args.Items) { if (comment.CommentId == this.comment_id) { _currentComment = comment; DataContext = comment; } } if (_currentComment == null) { UIThread.Invoke(() => { MessageBox.Show("Could not load the comment!", _localizedStrings.Messages.Info, MessageBoxButton.OK); }); } } else { this.HandleException(args.Error); } UIThread.Invoke(() => { ChangeApplicationBarAppearance(); }); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (this.NavigationContext.QueryString.TryGetValue("blog_id", out blog_id) && this.NavigationContext.QueryString.TryGetValue("comment_id", out comment_id)) { List<Blog> blogs = DataService.Current.Blogs.ToList(); foreach (Blog currentBlog in blogs) { if (currentBlog.isWPcom() || currentBlog.hasJetpack()) { string currentBlogID = currentBlog.isWPcom() ? Convert.ToString(currentBlog.BlogId) : currentBlog.getJetpackClientID(); if (currentBlogID == blog_id) { BlogName.Text = currentBlog.BlogName; _currentBlog = currentBlog; } } } } if (_currentBlog == null) { if (NavigationService.CanGoBack) { NavigationService.GoBack(); } return; } GetAllCommentsRPC rpc = new GetAllCommentsRPC(_currentBlog); rpc.Number = 20; rpc.Offset = 0; rpc.Completed += OnFetchCurrentBlogCommentsCompleted; rpc.ExecuteAsync(); UIThread.Invoke(() => { ApplicationBar.IsVisible = false; App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.Loading); }); }