public async Task CreateReplyPreview(ForumReplyEntity forumReplyEntity, bool isEdit)
 {
     IsLoading = true;
     var replyManager = new ReplyManager();
     string result;
     if (isEdit)
     {
         result = await replyManager.CreatePreviewEditPost(forumReplyEntity);
     }
     else
     {
         result = await replyManager.CreatePreviewPost(forumReplyEntity);
     }
     try
     {
         if (!string.IsNullOrEmpty(result))
         {
             Html = result;
         }
         else
         {
             string messageText =
                 string.Format(
                     "No text?! What good is showing you a preview then! Type something in and try again!{0}{1}",
                     Environment.NewLine, Constants.Ascii2);
             var msgDlg = new MessageDialog(messageText);
             await msgDlg.ShowAsync();
         }
     }
     catch (Exception ex)
     {
         AwfulDebugger.SendMessageDialogAsync("Failed to get the preview html", ex);
     }
     IsLoading = false;
 }
예제 #2
0
        private async void PreviewButton_Click(object sender, RoutedEventArgs e)
        {
            ItemGridView.Visibility           = Visibility.Collapsed;
            PreviewLastPostWebView.Visibility = Visibility.Visible;

            _forumReply.MapMessage(ReplyText.Text);
            var    replyManager = new ReplyManager();
            string result       = await replyManager.CreatePreviewEditPost(_forumReply);

            if (!string.IsNullOrEmpty(result))
            {
                PreviewLastPostWebView.NavigateToString(result);
                PreviewLastPostWebView.Visibility = Visibility.Visible;
            }
            else
            {
                LoadingProgressBar.Visibility = Visibility.Collapsed;
                string messageText =
                    string.Format(
                        "No text?! What good is showing you a preview then! Type something in and try again!{0}{1}",
                        Environment.NewLine, Constants.ASCII_2);
                var msgDlg = new MessageDialog(messageText);
                await msgDlg.ShowAsync();
            }
        }
예제 #3
0
        public async Task <bool> GetPreviewEditPost(string replyText)
        {
            Html      = string.Empty;
            IsLoading = true;
            ForumReplyEntity.MapMessage(replyText);
            var replyManager = new ReplyManager();

            try
            {
                Html = await replyManager.CreatePreviewEditPost(ForumReplyEntity);
            }
            catch (Exception ex)
            {
                AwfulDebugger.SendMessageDialogAsync("Could not create preview HTML", ex);
            }
            IsLoading = false;
            return(!string.IsNullOrEmpty(Html));
        }