Exemple #1
0
        private async void CommentSubmitButton_Click(object sender, RoutedEventArgs e)
        {
            string response = "";

            if (desktopPanel.Visibility == Visibility.Visible)
            {
                response = desktopCommentInputTextBox.Text;
            }
            else
            {
                response = phoneCommentInputTextBox.Text;
            }

            if (!response.StartsWith("@") && !string.IsNullOrEmpty(_dViewModel.ParentId))
            {
                _dViewModel.ParentId = "";
            }

            var dia = new ContentDialog()
            {
                Title               = "提示",
                Content             = new CommentSubmitDialogue(DataShareManager.Current.UserName, DataShareManager.Current.EmailAdd),
                PrimaryButtonText   = "发送",
                SecondaryButtonText = "取消",
                FullSizeDesired     = false
            };

            dia.PrimaryButtonClick += Dia_PrimaryButtonClick;

            var result = await dia.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                var message = $"message={response}&thread_id={_dViewModel.ThreadId}&parent_id={_dViewModel.ParentId}&author_name={DataShareManager.Current.UserName}&author_email={DataShareManager.Current.EmailAdd}";

                var r = await _dViewModel.PostComment(message);

                JsonObject j = new JsonObject();
                if (JsonObject.TryParse(r, out j))
                {
                    await PopupMessage("评论成功!", 40, 2000);
                }

                desktopCommentInputTextBox.Text = "";
                phoneCommentInputTextBox.Text   = "";
            }
        }
Exemple #2
0
        private async void CommentSubmitButton_Click(object sender, RoutedEventArgs e)
        {
            var response = _dViewModel.TextBoxComment;

            if (!response.StartsWith("@") && !string.IsNullOrEmpty(_dViewModel.ParentId))
            {
                _dViewModel.ParentId = "";
            }

            var dia = new ContentDialog()
            {
                Title               = "提示",
                Content             = new CommentSubmitDialogue(DataShareManager.Current.UserName, DataShareManager.Current.EmailAdd),
                PrimaryButtonText   = "发送",
                SecondaryButtonText = "取消",
                FullSizeDesired     = false,
                RequestedTheme      = DataShareManager.Current.AppTheme
            };

            dia.PrimaryButtonClick += Dia_PrimaryButtonClick;

            var result = await dia.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                var message = $"message={response}&thread_id={_dViewModel.ThreadId}&parent_id={_dViewModel.ParentId}&author_name={DataShareManager.Current.UserName}&author_email={DataShareManager.Current.EmailAdd}";

                var r = await _dViewModel.PostComment(message);

                _dViewModel.TextBoxComment = "";

                JsonObject j = new JsonObject();
                if (JsonObject.TryParse(r, out j))
                {
                    Debug.WriteLine(DateTime.Now.ToString() + "评论成功!");
                }
            }
        }