public async void OnDelete(int id) { //是否登录 var user = UserShared.GetAccessToken(this.Activity); if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now) { //未登录或清空Token失效 //清空Token UserShared.Update(this.Activity, new AccessToken()); await SQLiteUtils.Instance().DeleteUserAll(); Android.Support.V7.App.AlertDialog.Builder dialog = new Android.Support.V7.App.AlertDialog.Builder(this.Activity); dialog.SetMessage(Resources.GetString(Resource.String.need_login_tip)); dialog.SetPositiveButton(Resources.GetString(Resource.String.confirm), delegate { StartActivityForResult(new Intent(this.Activity, typeof(AuthorizeActivity)), (int)RequestCode.LoginCode); dialog.Dispose(); }); dialog.SetNegativeButton(Resources.GetString(Resource.String.cancel), delegate { dialog.Dispose(); }); dialog.Create().Show(); } else { var item = adapter.GetData().Where(a => a.Id == id).FirstOrDefault(); var child = recyclerView.FindViewWithTag(item.Id); child.FindViewById(Resource.Id.imgDelete).Visibility = ViewStates.Gone; child.FindViewById(Resource.Id.progressBar).Visibility = ViewStates.Visible; statusesPresenter.DeleteStatus(user, item.Id); } }
public void OnDelete(int id) { //ÊÇ·ñµÇ¼ var user = UserShared.GetAccessToken(this.Activity); if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now) { ShowLogin(); } else { var item = adapter.GetData().Where(a => a.WzLinkId == id).FirstOrDefault(); var child = recyclerView.FindViewWithTag(item.WzLinkId.ToString()); child.FindViewById(Resource.Id.imgDelete).Visibility = ViewStates.Gone; child.FindViewById(Resource.Id.progressBar).Visibility = ViewStates.Visible; bookmarksPresenter.DeleteBookmarkAsync(user, item.WzLinkId); } }
public void OnDelete(int commentId) { //ÊÇ·ñµÇ¼ var user = UserShared.GetAccessToken(this); if (user.access_token == "" || user.RefreshTime.AddSeconds(user.expires_in) < DateTime.Now) { ShowLogin(); } else { var item = adapter.GetData().Where(a => a.CommentID == commentId).FirstOrDefault(); var child = recyclerView.FindViewWithTag(commentId); child.FindViewById(Resource.Id.imgDelete).Visibility = ViewStates.Gone; child.FindViewById(Resource.Id.progressBar).Visibility = ViewStates.Visible; commentPresenter.DeleteComment(user, QuestionId, AnswerId, item.CommentID); } }