public void CommentReplyPostClick(CommentReplyClickEventArgs e) { try { if (TypeClass == "Reply") { var txtComment = ReplyCommentActivity.GetInstance().TxtComment; if (txtComment != null) { txtComment.Text = ""; txtComment.Text = "@" + e.CommentObject.Publisher.Username + " "; } } else { var intent = new Intent(MainContext, typeof(ReplyCommentActivity)); intent.PutExtra("CommentId", e.CommentObject.Id); intent.PutExtra("CommentObject", JsonConvert.SerializeObject(e.CommentObject)); MainContext.StartActivity(intent); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void CommentReplyPostClick(CommentReplyClickEventArgs e) { try { switch (TypeClass) { case "Reply": { var txtComment = ReplyCommentActivity.GetInstance().TxtComment; if (txtComment != null) { txtComment.Text = ""; txtComment.Text = "@" + e.CommentObject.Publisher.Username + " "; } break; } default: { var intent = new Intent(MainContext, typeof(ReplyCommentActivity)); intent.PutExtra("CommentId", e.CommentObject.Id); intent.PutExtra("CommentObject", JsonConvert.SerializeObject(e.CommentObject)); MainContext.StartActivity(intent); break; } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName, "edit_reply") }); } } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short).Show(); } catch (Exception e) { Console.WriteLine(e); } }); } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Console.WriteLine(e); } }
public void OnInput(MaterialDialog p0, ICharSequence p1) { try { if (p1.Length() > 0) { var strName = p1.ToString(); if (!Methods.CheckConnectivity()) { Toast.MakeText(MainContext, MainContext.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } else { if (TypeClass == "Comment") { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } var dataPost = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject.PostId).ToList(); if (dataPost?.Count > 0) { foreach (var post in dataPost) { if (post.TypeView != PostModelType.CommentSection) { continue; } var dataComment = post.PostData.GetPostComments?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataComment != null) { dataComment.Text = strName; var index = post.PostData.GetPostComments.IndexOf(dataComment); if (index > -1) { WRecyclerView.GetInstance()?.NativeFeedAdapter.NotifyItemChanged(index); } } } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName) }); } else if (TypeClass == "Reply") { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { dataGlobal.Text = strName; var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.NotifyItemChanged(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.EditCommentAsync(CommentObject.Id, strName, "edit_reply") }); } } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { switch (TypeClass) { case "Comment": { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } var dataPost = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost?.Count > 0) { foreach (var post in dataPost.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView?.RemoveByRowIndex(post); } } var dataPost2 = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost2?.Count > 0) { foreach (var post in dataPost2.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { WRecyclerView.GetInstance()?.RemoveByRowIndex(post); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); break; } case "Reply": { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); break; } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short)?.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }