示例#1
0
        //Contact User
        private void BtnContactOnClick(object sender, EventArgs e)
        {
            try
            {
                if (AppSettings.MessengerIntegration)
                {
                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                    {
                        try
                        {
                            Methods.App.OpenAppByPackageName(this, AppSettings.MessengerPackageName, "OpenChat", new ChatObject()
                            {
                                UserId = DataObject.UserData.UserId, Name = DataObject.UserData.Name, Avatar = DataObject.UserData.Avatar
                            });
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception);
                        }
                    });
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void MAdapterOnItemClick(object sender, ManageSessionsAdapterClickEventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show();
                    return;
                }

                ItemSessionsDataObject = MAdapter.GetItem(e.Position);
                if (ItemSessionsDataObject != null)
                {
                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_AreYouSureLogoutFromThisDevice));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AutoDismiss(true);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //Event Menu >> Edit Info Product if user == is_owner
        private void DeleteProduct_OnClick()
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog = "DeletePost";

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(GetText(Resource.String.Lbl_DeletePost));
                    dialog.Content(GetText(Resource.String.Lbl_AreYouSureDeletePost));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#4
0
        private void BtnAddPhoneNumberOnClick(object sender, EventArgs e)
        {
            try
            {
                FullNumber = TxtNumber2.Text;

                if (Regex.IsMatch(FullNumber, "^\\+?(\\d[\\d-. ]+)?(\\([\\d-. ]+\\))?[\\d-. ]+\\d$") &&
                    FullNumber.Length >= 10)
                {
                    if (!string.IsNullOrEmpty(FullNumber))
                    {
                        Intent intent = new Intent(ActivityContext, typeof(VerificationCodeActivity));
                        intent.PutExtra("Number", FullNumber);
                        ActivityContext.StartActivityForResult(intent, 125);

                        AddPhoneNumberWindow.Hide();
                        AddPhoneNumberWindow.Dismiss();
                    }
                }
                else
                {
                    var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(FullNumber + " " + ActivityContext.GetText(Resource.String.Lbl_ISNotValidNumber));
                    dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Ok)).OnPositive((materialDialog, action) => { dialog.Dispose(); });
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == ActivityContext.GetText(Resource.String.Lbl_Edit))
                {
                    //Open Edit Job
                    var intent = new Intent(ActivityContext, typeof(EditJobsActivity));
                    intent.PutExtra("JobsObject", JsonConvert.SerializeObject(DataInfoObject));
                    ActivityContext.StartActivityForResult(intent, 246);
                }
                else if (text == ActivityContext.GetText(Resource.String.Lbl_Delete))
                {
                    DialogType = "Delete";

                    var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(ActivityContext.GetText(Resource.String.Lbl_DeleteJobs));
                    dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(ActivityContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //Event Menu >> Delete Comment
        private void DeleteCommentEvent(CommentsArticlesObject item)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                    return;
                }

                TypeDialog    = "DeleteComment";
                CommentObject = item;

                var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                dialog.Title(MainContext.GetText(Resource.String.Lbl_DeleteComment)).TitleColorRes(Resource.Color.primary);
                dialog.Content(MainContext.GetText(Resource.String.Lbl_AreYouSureDeleteComment));
                dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                dialog.AlwaysCallSingleChoiceCallback();
                dialog.ItemsCallback(this).Build().Show();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //Event Menu >> Delete Comment
        private void DeleteCommentEvent(CommentObjectExtra item)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog    = "DeleteComment";
                    CommentObject = item;

                    var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(MainContext.GetText(Resource.String.Lbl_DeleteComment));
                    dialog.Content(MainContext.GetText(Resource.String.Lbl_AreYouSureDeleteComment));
                    dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#8
0
        private void ShareTimelineLayoutOnClick(object sender, EventArgs e)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog = "ShareToMyTimeline";

                    var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(Resource.String.Lbl_Share);
                    dialog.Content(Context.GetText(Resource.String.Lbl_ShareToMyTimeline));
                    dialog.PositiveText(Context.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(Context.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(Context, Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#9
0
        private void FilterButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                if (CategoriesController.ListCategories.Count > 0)
                {
                    var dialogList = new MaterialDialog.Builder(Activity).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                    var arrayAdapter = CategoriesController.ListCategories.Select(item => Methods.FunString.DecodeString(item.Name)).ToList();

                    arrayAdapter.Insert(0, GetString(Resource.String.Lbl_Default));
                    arrayAdapter.Insert(1, GetString(Resource.String.Lbl_MostPopular));

                    dialogList.Title(GetText(Resource.String.Lbl_SelectCategories));
                    dialogList.Content(GetText(Resource.String.Lbl_GetArticlesByCategories));
                    dialogList.Items(arrayAdapter);
                    dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                    dialogList.AlwaysCallSingleChoiceCallback();
                    dialogList.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Methods.DisplayReportResult(Activity, "Not have List Categories Blog");
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
示例#10
0
        public void ShowNormalDialog(string title, string content = null, string positiveText = null, string negativeText = null)
        {
            try
            {
                MaterialDialog.Builder dialogList = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                if (!string.IsNullOrEmpty(title))
                {
                    dialogList.Title(title);
                }

                if (!string.IsNullOrEmpty(content))
                {
                    dialogList.Content(content);
                }

                if (!string.IsNullOrEmpty(negativeText))
                {
                    dialogList.NegativeText(negativeText);
                    dialogList.OnNegative(this);
                }

                if (!string.IsNullOrEmpty(positiveText))
                {
                    dialogList.PositiveText(positiveText);
                    dialogList.OnPositive(this);
                }

                dialogList.Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //delete group chat
        private void BtnDeleteGroupOnClick(object sender, EventArgs e)
        {
            try
            {
                if (!Methods.CheckConnectivity())
                {
                    Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)
                    .Show();
                }
                else
                {
                    Type = "Delete";

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme
                        ? AFollestad.MaterialDialogs.Theme.Dark
                        : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Content(GetText(Resource.String.Lbl_AreYouSureDeleteGroup));
                    dialog.PositiveText(GetText(Resource.String.Lbl_DeleteGroup)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
示例#12
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                string text = itemString.ToString();
                if (text == GetText(Resource.String.Lbl_Edit))
                {
                    //Open Edit offer
                    var intent = new Intent(this, typeof(EditOffersActivity));
                    intent.PutExtra("OfferId", DataInfoObject.Id);
                    intent.PutExtra("OfferItem", JsonConvert.SerializeObject(DataInfoObject));
                    StartActivityForResult(intent, 246);
                }
                else if (text == GetText(Resource.String.Lbl_Delete))
                {
                    DialogType = "Delete";

                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_DeleteOffers));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //DeletePost
        public void OnMenuDeletePostOnClick(MoreFeedClickEventArgs feed)
        {
            try
            {
                if (Methods.CheckConnectivity())
                {
                    TypeDialog   = "DeletePost";
                    MoreFeedArgs = feed;

                    var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(MainContext.GetText(Resource.String.Lbl_DeletePost));
                    dialog.Content(MainContext.GetText(Resource.String.Lbl_AreYouSureDeletePost));
                    dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#14
0
        //DeleteSong
        private void OnMenuDeleteSongOnClick(MoreSongClickEventArgs song)
        {
            try
            {
                if (!UserDetails.IsLogin)
                {
                    PopupDialogController dialog = new PopupDialogController(GlobalContext, null, "Login");
                    dialog.ShowNormalDialog(GlobalContext.GetText(Resource.String.Lbl_Login), GlobalContext.GetText(Resource.String.Lbl_Message_Sorry_signin), GlobalContext.GetText(Resource.String.Lbl_Yes), GlobalContext.GetText(Resource.String.Lbl_No));
                    return;
                }


                if (Methods.CheckConnectivity())
                {
                    TypeDialog   = "DeleteSong";
                    MoreSongArgs = song;

                    var dialog = new MaterialDialog.Builder(MainContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                    dialog.Title(MainContext.GetText(Resource.String.Lbl_DeleteSong));
                    dialog.Content(MainContext.GetText(Resource.String.Lbl_AreYouSureDeleteSong));
                    dialog.PositiveText(MainContext.GetText(Resource.String.Lbl_Yes)).OnPositive(this);
                    dialog.NegativeText(MainContext.GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#15
0
        private void BtnFilterOnClick(object sender, EventArgs e)
        {
            try
            {
                if (CategoriesController.ListCategoriesMovies.Count > 0)
                {
                    var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    var arrayAdapter = CategoriesController.ListCategoriesMovies.Select(item => item.CategoriesName).ToList();

                    arrayAdapter.Insert(0, GetString(Resource.String.Lbl_Default));

                    dialogList.Title(GetText(Resource.String.Lbl_SelectCategories));
                    dialogList.Content(GetText(Resource.String.Lbl_GetMoviesByCategories));
                    dialogList.Items(arrayAdapter);
                    dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                    dialogList.AlwaysCallSingleChoiceCallback();
                    dialogList.ItemsCallback(this).Build().Show();
                }
                else
                {
                    Methods.DisplayReportResult(this, "Not have List Categories Movies");
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
示例#16
0
        public void ShowNormalDialog(string title, string content = null, string positiveText = null, string negativeText = null)
        {
            try
            {
                MaterialDialog.Builder DialogList = new MaterialDialog.Builder(ActivityContext);

                if (!string.IsNullOrEmpty(title))
                {
                    DialogList.Title(title);
                }

                if (!string.IsNullOrEmpty(content))
                {
                    DialogList.Content(content);
                }

                if (!string.IsNullOrEmpty(negativeText))
                {
                    DialogList.NegativeText(negativeText);
                    DialogList.OnNegative(this);
                }

                if (!string.IsNullOrEmpty(positiveText))
                {
                    DialogList.PositiveText(positiveText);
                    DialogList.OnPositive(this);
                }

                DialogList.Build().Show();
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
示例#17
0
        //Contact seller
        private void BtnContactOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (AppSettings.MessengerIntegration)
                {
                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                    {
                        try
                        {
                            Methods.App.OpenAppByPackageName(this, AppSettings.MessengerPackageName, "SendMsgProduct", new ChatObject()
                            {
                                UserId = ProductData.Seller.UserId, Avatar = ProductData.Seller.Avatar, Name = ProductData.Seller.Name, LastMessage = new LastMessageUnion()
                                {
                                    LastMessageClass = new MessageData()
                                    {
                                        ProductId = ProductData.Id, Product = new ProductUnion()
                                        {
                                            ProductClass = ProductData
                                        }
                                    }
                                }
                            });
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception);
                        }
                    });
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
                else
                {
                    if (!Methods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                        return;
                    }

                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    var time          = unixTimestamp.ToString();

                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Message.Send_Message(ProductData.Seller.UserId, time, "", "", "", "", "", "", ProductData.Id)
                    });
                    Toast.MakeText(this, GetString(Resource.String.Lbl_MessageSentSuccessfully), ToastLength.Short).Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#18
0
        //Remove
        private void MAdapterOnOnRemoveItemClick(object sender, AllMediaAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                if (position > -1)
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        if (!Methods.CheckConnectivity())
                        {
                            Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                            return;
                        }

                        if (!string.IsNullOrEmpty(item.Id))
                        {
                            var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
                            dialog.Title(GetText(Resource.String.Lbl_Warning));
                            dialog.Content(GetText(Resource.String.Lbl_AskDeleteFile));
                            dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                            {
                                try
                                {
                                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                                        () => RequestsAsync.Users.DeleteMediaFileUserAsync(item.Id)
                                    });

                                    MAdapter.Remove(item);

                                    var dataUser  = ListUtils.MyUserInfo.FirstOrDefault();
                                    var dataImage = dataUser?.Mediafiles?.FirstOrDefault(file => file.Id == item.Id);
                                    if (dataImage != null)
                                    {
                                        dataUser.Mediafiles?.Remove(dataImage);

                                        SqLiteDatabase dbDatabase = new SqLiteDatabase();
                                        dbDatabase.InsertOrUpdate_DataMyInfo(dataUser);
                                        dbDatabase.Dispose();
                                    }
                                }
                                catch (Exception exception)
                                {
                                    Console.WriteLine(exception);
                                }
                            });
                            dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                            dialog.AlwaysCallSingleChoiceCallback();
                            dialog.Build().Show();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
示例#19
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);
            }
        }
示例#20
0
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                if (itemString.ToString() == GetText(Resource.String.Lbl_CreateNewGroup))
                {
                    StartActivity(new Intent(Activity, typeof(CreateGroupChatActivity)));
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_GroupRequest))
                {
                    StartActivity(new Intent(Activity, typeof(GroupRequestActivity)));
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_Blocked_User_List))
                {
                    StartActivity(new Intent(Activity, typeof(BlockedUsersActivity)));
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_Settings))
                {
                    StartActivity(new Intent(Activity, typeof(GeneralAccountActivity)));
                }
                else if (itemString.ToString() == GetText(Resource.String.Lbl_Clear_call_log))
                {
                    var dialog = new MaterialDialog.Builder(Activity).Theme(AppSettings.SetTabDarkTheme
                        ? Theme.Dark
                        : Theme.Light);
                    dialog.Title(GetText(Resource.String.Lbl_Warning));
                    dialog.Content(GetText(Resource.String.Lbl_Clear_call_log));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                    {
                        try
                        {
                            LastCallsTab?.MAdapter?.MCallUser?.Clear();
                            LastCallsTab?.MAdapter?.NotifyDataSetChanged();
                            LastCallsTab?.ShowEmptyPage();

                            //Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long)?.Show();

                            SqLiteDatabase dbDatabase = new SqLiteDatabase();
                            dbDatabase.Clear_CallUser_List();
                        }
                        catch (Exception e)
                        {
                            Methods.DisplayReportResultTrack(e);
                        }
                    });
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(new WoWonderTools.MyMaterialDialog());
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#21
0
        //Contact seller
        private void BtnContactOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (AppSettings.MessengerIntegration)
                {
                    var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                    dialog.Title(Resource.String.Lbl_Warning);
                    dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger));
                    dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                    {
                        try
                        {
                            Intent intent = new Intent(this, typeof(ChatWindowActivity));
                            intent.PutExtra("UserID", ProductData.Seller.UserId);
                            intent.PutExtra("TypeChat", "User");
                            intent.PutExtra("UserItem", JsonConvert.SerializeObject(ProductData.Seller));
                            StartActivity(intent);
                        }
                        catch (Exception exception)
                        {
                            Methods.DisplayReportResultTrack(exception);
                        }
                    });
                    dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                    dialog.AlwaysCallSingleChoiceCallback();
                    dialog.Build().Show();
                }
                else
                {
                    if (!Methods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show();
                        return;
                    }

                    var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
                    var time          = unixTimestamp.ToString();

                    PollyController.RunRetryPolicyFunction(new List <Func <Task> > {
                        () => RequestsAsync.Message.Send_Message(ProductData.Seller.UserId, time, "", "", "", "", "", "", ProductData.Id)
                    });
                    Toast.MakeText(this, GetString(Resource.String.Lbl_MessageSentSuccessfully), ToastLength.Short)?.Show();
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
示例#22
0
        private void MAdapterOnMessageButtonItemClick(object sender, ShowApplyJobsAdapterClickEventArgs e)
        {
            try
            {
                var item = MAdapter.GetItem(e.Position);
                if (item != null)
                {
                    switch (AppSettings.MessengerIntegration)
                    {
                    case true when AppSettings.ShowDialogAskOpenMessenger:
                    {
                        var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                        dialog.Title(Resource.String.Lbl_Warning).TitleColorRes(Resource.Color.primary);
                        dialog.Content(GetText(Resource.String.Lbl_ContentAskOPenAppMessenger));
                        dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                            {
                                try
                                {
                                    Intent intent = new Intent(this, typeof(ChatWindowActivity));
                                    intent.PutExtra("UserID", item.UserData.UserId);
                                    intent.PutExtra("TypeChat", "User");
                                    intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.UserData));
                                    StartActivity(intent);
                                }
                                catch (Exception exception)
                                {
                                    Methods.DisplayReportResultTrack(exception);
                                }
                            });
                        dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(new WoWonderTools.MyMaterialDialog());
                        dialog.AlwaysCallSingleChoiceCallback();
                        dialog.Build().Show();
                        break;
                    }

                    case true:
                        Intent intent = new Intent(this, typeof(ChatWindowActivity));
                        intent.PutExtra("UserID", item.UserData.UserId);
                        intent.PutExtra("TypeChat", "User");
                        intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.UserData));
                        StartActivity(intent);
                        break;
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
示例#23
0
        /// <summary>
        /// 显示一个包含“确定”和“取消”按钮的提示对话框。
        /// </summary>
        /// <param name="title">对话框的标题。</param>
        /// <param name="content">可选,对话框的内容。默认为空。</param>
        /// <param name="callback">如果用户点击“确定”则返回 true ,否则返回 false</param>
        public void confirm(string title, string content = "", Action <bool> callback = null)
        {
            var context = GetActivityContext();

            var result = new CallBackData();

            var action = new Action <bool>((value) =>
            {
                if (result.IsEnd)
                {
                    return;
                }

                result.IsEnd = true;
                callback?.Invoke(value);
            });

            var builder = new MaterialDialog.Builder(context)
                          .Title(title)
                          .PositiveText("确定")
                          .NegativeText("取消")
                          .DismissListener(dialog =>
            {
                if (result.IsEnd)
                {
                    return;
                }

                action.Invoke(false);
            })
                          .OnAny((dialog, which) =>
            {
                if (which == DialogAction.Positive)
                {
                    action.Invoke(true);
                }
                else
                {
                    action.Invoke(false);
                }
            });

            if (!string.IsNullOrWhiteSpace(content))
            {
                builder.Content(content);
            }

            Show(builder);
        }
示例#24
0
 //Logout
 private void LogoutPrefOnPreferenceClick(object sender, Preference.PreferenceClickEventArgs e)
 {
     try
     {
         var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
         dialog.Title(Resource.String.Lbl_Warning);
         dialog.Content(GetText(Resource.String.Lbl_Are_you_logout));
         dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this);
         dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
         dialog.AlwaysCallSingleChoiceCallback();
         dialog.Build().Show();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
示例#25
0
        public async void ShowPlayListDialog()
        {
            try
            {
                MaterialDialog.Builder progressDialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);
                progressDialog.Title(ActivityContext.GetText(Resource.String.Lbl_Checking_PlayLists_info));
                progressDialog.Content(ActivityContext.GetText(Resource.String.Lbl_Please_wait));
                progressDialog.Progress(true, 0);
                progressDialog.ProgressIndeterminateStyle(true);

                MaterialDialog dialog = progressDialog.Build();
                dialog.Show();

                if (ListUtils.PlayListVideoObjectList.Count == 0)
                {
                    await ApiRequest.PlayListsVideosApi(ActivityContext);
                }

                dialog.Dismiss();

                List <string>          arrayAdapter = new List <string>();
                MaterialDialog.Builder dialogList   = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                var count = ListUtils.PlayListVideoObjectList.Count;
                if (count > 0)
                {
                    for (int i = 0; i < count; i++)
                    {
                        if (!string.IsNullOrEmpty(ListUtils.PlayListVideoObjectList[i].Name))
                        {
                            arrayAdapter.Add(ListUtils.PlayListVideoObjectList[i].Name);
                        }
                    }
                }

                dialogList.Title(ActivityContext.GetText(Resource.String.Lbl_Select_One_Name));
                dialogList.Items(arrayAdapter);
                dialogList.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Creat_new)).OnPositive(this);
                dialogList.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialogList.ItemsCallback(this).Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
 private void MAdapterOnOnItemClick(object sender, BlockedUsersAdapterClickEventArgs e)
 {
     try
     {
         Position = e.Position;
         var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
         dialog.Title(Resource.String.Lbl_Warning);
         dialog.Content(GetText(Resource.String.Lbl_DoYouWantUnblock));
         dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this);
         dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
         dialog.AlwaysCallSingleChoiceCallback();
         dialog.Build().Show();
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
示例#27
0
        private void SubscribeChannelWithPaidButtonOnClick(object sender, EventArgs e)
        {
            try
            {
                //This channel is paid, You must pay to subscribe
                var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                dialog.Title(Resource.String.Lbl_Warning);
                dialog.Content(Context.GetText(Resource.String.Lbl_ChannelIsPaid));
                dialog.PositiveText(Context.GetText(Resource.String.Lbl_Ok)).OnPositive(this);
                dialog.NegativeText(Context.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialog.AlwaysCallSingleChoiceCallback();
                dialog.Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        //Delete Account
        private void DeleteAccountPref_OnPreferenceClick(object sender,
                                                         Preference.PreferenceClickEventArgs preferenceClickEventArgs)
        {
            try
            {
                var dialog = new MaterialDialog.Builder(ActivityContext);

                dialog.Title(Resource.String.Lbl_Warning);
                dialog.Content(ActivityContext.GetText(Resource.String.Lbl_Are_you_DeleteAccount) + " " + Settings.Application_Name);
                dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Ok)).OnPositive(this);
                dialog.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialog.ItemsCallback(this).Build().Show();
                dialog.AlwaysCallSingleChoiceCallback();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
示例#29
0
        //Privacy >> Clear
        //===================================================
        private void ClearCacheOnPreferenceClick(object sender, Preference.PreferenceClickEventArgs preferenceClickEventArgs)
        {
            try
            {
                var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                dialog.Title(GetText(Resource.String.Lbl_Warning));
                dialog.Content(GetText(Resource.String.Lbl_TheFilesWillBeDeleted));
                dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) =>
                {
                    Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_FilesAreNowDeleted), ToastLength.Long).Show();

                    Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            var dirPath = ActivityContext.CacheDir;
                            dirPath.Delete();

                            string path = Methods.Path.FolderDcimMyApp;
                            if (Directory.Exists(path))
                            {
                                Directory.Delete(path, true);
                            }

                            Methods.Path.Chack_MyFolder();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                        }
                    });
                });
                dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
                dialog.AlwaysCallSingleChoiceCallback();
                dialog.Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
示例#30
0
        //Delete Account
        private void DeleteAccountPref_OnPreferenceClick(object sender, Preference.PreferenceClickEventArgs preferenceClickEventArgs)
        {
            try
            {
                TypeDialog = "DeleteAccount";

                var dialog = new MaterialDialog.Builder(ActivityContext).Theme(AppSettings.SetTabDarkTheme ? Theme.Dark : Theme.Light);

                dialog.Title(Resource.String.Lbl_Warning);
                dialog.Content(ActivityContext.GetText(Resource.String.Lbl_Are_you_DeleteAccount) + " " + AppSettings.ApplicationName);
                dialog.PositiveText(ActivityContext.GetText(Resource.String.Lbl_Ok)).OnPositive(this);
                dialog.NegativeText(ActivityContext.GetText(Resource.String.Lbl_Cancel)).OnNegative(this);
                dialog.Build().Show();
                dialog.AlwaysCallSingleChoiceCallback();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }