Exemplo n.º 1
0
 private void ReplyButtonClick(object sender, RoutedEventArgs e)
 {
     try
     {
         if (sender is HyperlinkButton btn && btn != null)
         {
             if (btn.DataContext is RecentActivityFeed data && data != null)
             {
                 ActivitiesVM.CommentFeed = data;
                 ShowComments();
                 CommentText.PlaceholderText = $"Reply to @{data.ProfileName ?? string.Empty}'s comment";
                 CommentText.Text            = $"@{data.ProfileName ?? string.Empty} ";
                 CommentText.Focus(FocusState.Keyboard);
             }
         }
     }
     catch { }
 }
Exemplo n.º 2
0
        private async void CommentButtonClick(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(CommentText.Text))
                {
                    CommentText.Focus(FocusState.Keyboard);
                    return;
                }
                var feed = ActivitiesVM.CommentFeed;
                if (feed == null)
                {
                    HideComments();
                    return;
                }

                var result = await Helper.InstaApi.CommentProcessor.ReplyCommentMediaAsync(feed.Medias[0].Id, feed.CommentId.ToString(), CommentText.Text);

                HideComments();
                ActivitiesVM.CommentFeed = null;
                if (result.Succeeded)
                {
                    Helper.ShowNotify("Comment sent successfully.");
                    CommentText.Text = "";
                }
                else
                {
                    switch (result.Info.ResponseType)
                    {
                    case ResponseType.RequestsLimit:
                    case ResponseType.SentryBlock:
                        Helper.ShowNotify(result.Info.Message);
                        break;

                    case ResponseType.ActionBlocked:
                        Helper.ShowNotify("Action blocked.\r\nPlease try again 5 or 10 minutes later");
                        break;
                    }
                }
            }
            catch { }
        }