private async void btnSpamComments_Click(object sender, RoutedEventArgs e)
        {
            if (_spamCommentsList == null || _spamCommentsList.Length == 0)
            {
                return;
            }

            btnSpamComments.IsEnabled = false;

            try
            {
                for (int i = 0; i < txtCommentsCount.Value; ++i)
                {
                    await PostApi.AddComment(SettingsManager.PersistentSettings.CurrentUser.Token,
                                             int.Parse(txtCommentsPostId?.Value?.ToString() ?? string.Empty),
                                             _spamCommentsList[Random.Next(0, _spamCommentsList.Length - 1)],
                                             chkAnonymousComments.IsChecked)
                    .ConfigureAwait(true);
                }

                await DialogManager.ShowDialog("Success", "Comment section destroyed ;)")
                .ConfigureAwait(true);
            }
            catch (Exception ex)
            {
                await DialogManager.ShowDialog("Some rtarded shit happened", ex.Message)
                .ConfigureAwait(true);
            }
            finally
            {
                btnSpamComments.IsEnabled = true;
            }
        }
Ejemplo n.º 2
0
        private async void btnSend_Click(object sender, RoutedEventArgs e)
        {
            btnSend.IsEnabled = false;

            btnSend.Focus();

            var result = await PostApi.AddComment(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                PostId, txtContent.Text, IsAnonymous)
                         .ConfigureAwait(true);

            if (result.IsError)
            {
                await DialogManager.ShowErrorDialog(result.Message)
                .ConfigureAwait(true);

                btnSend.IsEnabled = true;
                return;
            }

            txtContent.Text = string.Empty;

            RaiseEvent(new RoutedEventArgs(OnCommentAdded));

            txtContent.Focus();

            btnSend.IsEnabled = true;
        }
Ejemplo n.º 3
0
        private async void SendButton_Click(object sender,
                                            RoutedEventArgs e)
        {
            SendButton.IsEnabled = false;

            SendButton.Focus();

            var result = await PostApi.AddComment(
                SettingsManager.PersistentSettings.CurrentUser.Token,
                PostId, ContentTextBox.Text, IsAnonymous)
                         .ConfigureAwait(true);

            if (result.IsError)
            {
                await DialogManager.ShowErrorDialog(result.Message)
                .ConfigureAwait(true);

                SendButton.IsEnabled = true;
                return;
            }

            ContentTextBox.Text = string.Empty;

            RaiseEvent(new RoutedEventArgs(CommentAddEvent));

            ContentTextBox.Focus();

            SendButton.IsEnabled = true;
        }