Esempio n. 1
0
        private Task <string> OnJavascriptInjectionRequest(string eventobj)
        {
            try
            {
                if (!string.IsNullOrEmpty(eventobj))
                {
                    if (eventobj.Contains("type"))
                    {
                        var data = JsonConvert.DeserializeObject <Dictionary <string, object> >(eventobj);
                        var type = data["type"].ToString();

                        if (type == "delete_post")
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                try
                                {
                                    var DialogList = new MaterialDialog.Builder(Context);
                                    DialogList.Tag(data["post_id"].ToString());
                                    DialogList.Title(Context.GetText(Resource.String.Lbl_Title_DeletePost));
                                    DialogList.Content(Context.GetText(Resource.String.Lbl_Content_DeletePost));
                                    DialogList.NegativeText(Context.GetText(Resource.String.Lbl_Cancel));
                                    DialogList.OnNegative(this);
                                    DialogList.PositiveText(Context.GetText(Resource.String.Lbl_Delete));
                                    DialogList.OnPositive(this);
                                    DialogList.Build().Show();
                                }
                                catch (Exception exception)
                                {
                                    Crashes.TrackError(exception);
                                }
                            });
                        }
                        else if (type == "publisher-box")
                        {
                            Activity.RunOnUiThread(() =>
                            {
                                var Int = new Intent(Activity, typeof(AddPost_Activity));
                                Int.PutExtra("Type", "Normal");
                                Int.PutExtra("PostId", UserDetails.User_id);
                                Int.PutExtra("isOwner", "Normal");
                                StartActivityForResult(Int, 2500);
                            });
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }

                return(null);
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                return(null);
            }
        }