public async override void Execute(object parameter) { long id = long.Parse((string)parameter); var vm = Locator.ViewModels.ThreadPageVm; if (vm == null) return; Locator.ViewModels.NewThreadReplyVm.PostBody = string.Empty; Locator.ViewModels.NewThreadReplyVm.IsEdit = true; Locator.ViewModels.NewThreadReplyVm.ForumThreadEntity = vm.ForumThreadEntity; App.RootFrame.Navigate(typeof(EditPostPage)); Locator.ViewModels.NewThreadReplyVm.IsLoading = true; try { var replyManager = new ReplyManager(); Locator.ViewModels.NewThreadReplyVm.ForumReplyEntity = await replyManager.GetReplyCookiesForEdit(id); Locator.ViewModels.NewThreadReplyVm.PostBody = Locator.ViewModels.NewThreadReplyVm.ForumReplyEntity.Quote; } catch (Exception ex) { AwfulDebugger.SendMessageDialogAsync("Can't reply in this thread.", ex); App.RootFrame.GoBack(); } Locator.ViewModels.NewThreadReplyVm.IsLoading = false; }
public async override void Execute(object parameter) { long id = long.Parse((string)parameter); var vm = Locator.ViewModels.ThreadPageVm; if (vm == null) { return; } Locator.ViewModels.NewThreadReplyVm.PostBody = string.Empty; Locator.ViewModels.NewThreadReplyVm.IsEdit = true; Locator.ViewModels.NewThreadReplyVm.ForumThreadEntity = vm.ForumThreadEntity; App.RootFrame.Navigate(typeof(EditPostPage)); Locator.ViewModels.NewThreadReplyVm.IsLoading = true; try { var replyManager = new ReplyManager(); Locator.ViewModels.NewThreadReplyVm.ForumReplyEntity = await replyManager.GetReplyCookiesForEdit(id); Locator.ViewModels.NewThreadReplyVm.PostBody = Locator.ViewModels.NewThreadReplyVm.ForumReplyEntity.Quote; } catch (Exception ex) { AwfulDebugger.SendMessageDialogAsync("Can't reply in this thread.", ex); App.RootFrame.GoBack(); } Locator.ViewModels.NewThreadReplyVm.IsLoading = false; }
public async Task <bool> InitializeEdit(string jsonObjectString) { IsLoading = true; long threadId = Convert.ToInt64(jsonObjectString);; try { var replyManager = new ReplyManager(); ForumReplyEntity = await replyManager.GetReplyCookiesForEdit(threadId); } catch (Exception ex) { AwfulDebugger.SendMessageDialogAsync("You can't edit this post!", ex); } IsLoading = false; return(ForumReplyEntity != null); }
/// <summary> /// Populates the page with content passed during navigation. Any saved state is also /// provided when recreating a page from a prior session. /// </summary> /// <param name="sender"> /// The source of the event; typically <see cref="NavigationHelper" /> /// </param> /// <param name="e"> /// Event data that provides both the navigation parameter passed to /// <see cref="Frame.Navigate(Type, Object)" /> when this page was initially requested and /// a dictionary of state preserved by this page during an earlier /// session. The state will be null the first time a page is visited. /// </param> private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e) { LoadingProgressBar.Visibility = Visibility.Visible; var jsonObjectString = (string)e.NavigationParameter; long threadId = Convert.ToInt64(jsonObjectString); _forumReply = await _replyManager.GetReplyCookiesForEdit(threadId); if (_forumReply == null) { var msgDlg = new MessageDialog("You can't edit this post!"); await msgDlg.ShowAsync(); Frame.GoBack(); return; } ReplyText.Text = _forumReply.Quote; PreviewLastPostWebView.NavigateToString(_forumReply.PreviousPostsRaw); LoadingProgressBar.Visibility = Visibility.Collapsed; }