Пример #1
0
 private void InitShowDialog()
 {
     dialog_ShowBuilder = new AndroidX.AppCompat.App.AlertDialog.Builder(this, Resource.Style.Theme_Dialog_FullScreen);
     dialog_Show        = dialog_ShowBuilder.Create();
     dialog_Show.Show();
     dialog_Show.Dismiss();
 }
Пример #2
0
        public static Task <JwtLoginCredentials> GetInputAsync(string title)
        {
            var         context = GetContext();
            var         tcs     = new TaskCompletionSource <JwtLoginCredentials>();
            var         result  = new JwtLoginCredentials();
            AlertDialog dialog  = null;

            AlertDialog.Builder builder = new AlertDialog.Builder(context);
            builder.SetTitle(title);

            var viewInflated  = LayoutInflater.From(context).Inflate(Resource.Layout.login_view, null, false);
            var userInput     = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_user);
            var passwordInput = viewInflated.FindViewById <AppCompatEditText>(Resource.Id.input_password);

            builder.SetView(viewInflated);

            builder.SetOnCancelListener(new DialogInterfaceOnCancelListener(() => tcs.TrySetResult(null)));
            builder.SetOnDismissListener(new DialogInterfaceOnDismissListener(() => tcs.TrySetResult(null)));
            builder.SetPositiveButton(Android.Resource.String.Ok, (sender, args) =>
            {
                result.User     = userInput.Text;
                result.Password = passwordInput.Text;
                tcs.TrySetResult(result);
                dialog.Dismiss();
            });
            builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, args) =>
            {
                tcs.TrySetResult(null);
                dialog.Cancel();
            });

            dialog = builder.Show();

            return(tcs.Task);
        }
Пример #3
0
 public void HideWaitDiaLog()
 {
     dialog_Show?.Dismiss();
 }
Пример #4
0
 /// <summary>
 /// 显示Android提示框
 /// </summary>
 /// <param name="title">标题</param>
 /// <param name="msg">内容消息</param>
 /// <param name="onSureClick">确定事件</param>
 /// <param name="onCancelClick">取消事件</param>
 /// <param name="sureText">确定文字</param>
 /// <param name="cancelText">取消文字</param>
 public void ShowAndroidPromptBox(string title, string msg, Action onSureClick, Action onCancelClick, bool isCancelable = false, string sureText = "确定", string cancelText = "取消")
 {
     AndroidX.AppCompat.App.AlertDialog jk = null;
     jk =
         new AndroidX.AppCompat.App.AlertDialog.Builder(this)
         .SetTitle(title)
         .SetMessage(msg)
         .SetCancelable(isCancelable)
         .SetPositiveButton(sureText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onSureClick?.Invoke(); })
         .SetNegativeButton(cancelText, (object sender, DialogClickEventArgs eve) => { jk.Dismiss(); jk = null; onCancelClick?.Invoke(); })
         .Show();
 }
        private void ImgButtonOnClick(ReactionsClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(Application.Context, Application.Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                switch (UserDetails.SoundControl)
                {
                case true:
                    Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("reaction.mp3");
                    break;
                }

                PostData.CommentObject.Reaction ??= new WoWonderClient.Classes.Posts.Reaction();

                if (PostData.CommentObject.Reaction.IsReacted != null && !PostData.CommentObject.Reaction.IsReacted.Value)
                {
                    PostData.CommentObject.Reaction.IsReacted = true;
                    PostData.CommentObject.Reaction.Count++;
                }

                if (PostData.Holder.CountLike != null && PostData.CommentObject.Reaction.Count > 0)
                {
                    PostData.Holder.CountLikeSection.Visibility = ViewStates.Visible;
                    PostData.Holder.CountLike.Text = Methods.FunString.FormatPriceValue(PostData.CommentObject.Reaction.Count);
                }
                else
                {
                    PostData.Holder.CountLikeSection.Visibility = ViewStates.Gone;
                }

                var data = MReactionPack[e.Position];
                if (data != null)
                {
                    SetReactionPack(PostData.Holder, data.GetReactText());
                    PostData.Holder.LikeTextView.Tag = "Liked";
                }

                string reactionType = TypeClass switch
                {
                    "Reply" => "reaction_reply",
                    _ => "reaction_comment"
                };

                if (e.React == ReactConstants.Like)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_like);

                    PostData.CommentObject.Reaction.Type = "1";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Like").Value?.Id ?? "1";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }
                else if (e.React == ReactConstants.Love)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_love);

                    PostData.CommentObject.Reaction.Type = "2";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Love").Value?.Id ?? "2";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }
                else if (e.React == ReactConstants.HaHa)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_haha);

                    PostData.CommentObject.Reaction.Type = "3";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "HaHa").Value?.Id ?? "3";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }
                else if (e.React == ReactConstants.Wow)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_wow);

                    PostData.CommentObject.Reaction.Type = "4";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Wow").Value?.Id ?? "4";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }
                else if (e.React == ReactConstants.Sad)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_sad);

                    PostData.CommentObject.Reaction.Type = "5";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Sad").Value?.Id ?? "5";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }
                else if (e.React == ReactConstants.Angry)
                {
                    PostData.Holder.ImageCountLike.SetImageResource(Resource.Drawable.emoji_angry);

                    PostData.CommentObject.Reaction.Type = "6";
                    string react = ListUtils.SettingsSiteList?.PostReactionsTypes?.FirstOrDefault(a => a.Value?.Name == "Angry").Value?.Id ?? "6";
                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Comment.ReactionCommentAsync(PostData.CommentObject.Id, react, reactionType)
                    });
                }

                MReactAlertDialog.Dismiss();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }