Exemplo n.º 1
0
        public ModelPayment(BsonDocument DetailPay)
        {
            InitializeComponent();
            try
            {
                TextID.Text      = DetailPay["ID"].ToString();
                TextCreated.Text = DetailPay["Created"].ToLocalTime().ToString();
                TextCash.Text    = DetailPay["Cash"].ToString();
                TextCreator.Text = DetailPay["Creator"].ToString();
            }
            catch (Exception)
            {
                TextID.Text      = DetailPay["Request"]["order_id"].ToString();
                TextCreated.Text = DetailPay["Detail"]["Created"].ToLocalTime().ToString();
                TextCash.Text    = DetailPay["Request"]["amount"].ToString();
                TextCreator.Text = DetailPay["Detail"]["Token"].ToString();
            }


            BTNShowDetail.MouseDown += (obj, e) =>
            {
                var Message = "";
                foreach (var item in DetailPay)
                {
                    Message += item.Name + " : " + item.Value.ToString() + "\n";
                }
                Message += "\n" + "In this transaction, the above information has replaced the values";

                DashboardGame.Dialog(Message, "Detail Pay");
            };
        }
Exemplo n.º 2
0
        public ModelInternalNotifaction(BsonDocument Detail, Action RefreshList)
        {
            InitializeComponent();

            this.Detail = Detail;

            TextHeader.Text      = Detail["Header"].ToString();
            TextDescription.Text = Detail["Description"].ToString();

            var Time = Detail["Time"].ToLocalTime();

            if (DateTime.Now.AddHours(-3) <= Detail["Time"].ToLocalTime())
            {
                TextTime.Text = Time.Hour + ":" + Time.ToLocalTime().Minute;
            }
            else
            {
                TextTime.Text = Time.Hour + ":" + Time.Minute + "  " + Time.Year + "/" + Time.Month + "/" + Time.Day;
            }


            //remove singel Notif
            BTNDelete.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageLog.DeleteLog(Detail, result =>
                {
                    (Parent as StackPanel).Children.Remove(this);

                    RefreshList();
                });
            };



            //collepts btn see detail Here
            if (Detail["Detail"].AsBsonDocument.ElementCount <= 0)
            {
                BTNDetail.Visibility = Visibility.Collapsed;
            }
            else
            {
                BTNDetail.MouseDown += (s, e) =>
                {
                    var serilsedetail = "";

                    foreach (var item in Detail["Detail"].AsBsonDocument)
                    {
                        serilsedetail += item.Name + " : " + item.Value + "\n";
                    }

                    DashboardGame.Dialog(serilsedetail, Detail["Header"].ToString());
                };
            };
        }
Exemplo n.º 3
0
        private void OpenState(object sender, MouseButtonEventArgs e)
        {
            SDK.SDK_PageDashboards.DashboardGame.PageStudios.Status(
                result =>
            {
                var Text = "";
                foreach (var item in result)
                {
                    Text += item.Name + ": " + item.Value.ToString() + "\n";
                }

                DashboardGame.Dialog(Text, "Server State");
            },
                () =>
            {
                DashboardGame.Notifaction("Faild Recive", StatusMessage.Error);
            });
        }
Exemplo n.º 4
0
        public EditPlayer(IEditPlayer EditPlayer)
        {
            InitializeComponent();
            //frist init
            Editor = EditPlayer;

            CurentPage      = PageAccount;
            CurentBTNHeader = BTNAccount;

            #region PageSetting

            //change frist
            TextIDPlayer_Header.Text = EditPlayer.DetailPlayer["Account"]["Token"].AsObjectId.ToString();
            TextboxNickname.Text     = EditPlayer.DetailPlayer["Account"]["Name"].AsString;
            TextboxAvatar.Text       = EditPlayer.DetailPlayer["Account"]["Avatar"].AsString;
            TextLanguage.Text        = EditPlayer.DetailPlayer["Account"]["Language"].AsString;
            TextCreated.Text         = EditPlayer.DetailPlayer["Account"]["Created"].ToUniversalTime().ToString();
            TextCountry.Text         = EditPlayer.DetailPlayer["Account"]["Country"].AsString;
            TextboxUsername.Text     = EditPlayer.DetailPlayer["Account"]["Username"].AsString;
            TextboxEmail.Text        = EditPlayer.DetailPlayer["Account"]["Email"].AsString;
            TextToken.Text           = EditPlayer.DetailPlayer["Account"]["Token"].AsObjectId.ToString();
            Textboxphone.Text        = EditPlayer.DetailPlayer["Account"]["Phone"].ToString();

            try
            {
                TextCountTags.Text = EditPlayer.DetailPlayer["Account"]["Tags"].AsBsonArray.Count.ToString();
            }
            catch (Exception)
            {
                EditPlayer.DetailPlayer["Account"].AsBsonDocument.Add("Tags", new BsonArray());
                EditPlayer.Save();
            }


            //cheak banplayer
            CheackBoxBan.IsChecked = EditPlayer.DetailPlayer["Account"]["IsBan"].AsBoolean;
            CheackBoxBan.Checked  += (s, e) =>
            {
                EditPlayer.DetailPlayer["Account"]["IsBan"] = true;
                EditPlayer.Save();
            };
            CheackBoxBan.Unchecked += (s, e) =>
            {
                EditPlayer.DetailPlayer["Account"]["IsBan"] = false;
                EditPlayer.Save();
            };


            //action  Change NickName
            TextboxNickname.LostFocus += (s, e) =>
            {
                EditPlayer.DetailPlayer["Account"]["Name"] = TextboxNickname.Text;
                EditPlayer.Save();
            };

            //action change nickname
            TextboxAvatar.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinkImages(TextboxAvatar))
                {
                    EditPlayer.DetailPlayer["Account"]["Avatar"] = TextboxAvatar.Text;
                    EditPlayer.Save();
                }
                else
                {
                    TextboxAvatar.Text = EditPlayer.DetailPlayer["Account"]["Avatar"].ToString();
                }
            };

            //action change Language
            TextLanguage.LostFocus += (s, e) =>
            {
                EditPlayer.DetailPlayer["Account"]["Language"] = TextLanguage.Text;
                EditPlayer.Save();
            };

            //action change Cuntry
            TextCountry.LostFocus += (s, e) =>
            {
                EditPlayer.DetailPlayer["Account"]["Country"] = TextCountry.Text;
                EditPlayer.Save();
            };

            //action change Username
            TextboxUsername.LostFocus += (s, e) =>
            {
                if (TextboxUsername.Text.Length >= 6)
                {
                    if (TextboxUsername.Text != EditPlayer.DetailPlayer["Account"]["Username"].ToString())
                    {
                        SDK.SDK_PageDashboards.DashboardGame.PagePlayers.SearchUsername(TextboxUsername.Text, result =>
                        {
                            if (result)
                            {
                                DashboardGame.Notifaction("Username is duplicate ", Notifaction.StatusMessage.Error);
                                TextboxUsername.Text = EditPlayer.DetailPlayer["Account"]["Username"].ToString();
                            }
                            else
                            {
                                EditPlayer.DetailPlayer["Account"]["Username"] = TextboxUsername.Text;
                                EditPlayer.Save();
                            }
                        });
                    }
                }
                else
                {
                    DashboardGame.Notifaction("Username Short", Notifaction.StatusMessage.Error);
                    TextboxUsername.Text = EditPlayer.DetailPlayer["Account"]["Username"].ToString();
                }
            };

            //action change email
            TextboxEmail.LostFocus += (s, e) =>
            {
                try
                {
                    new System.Net.Mail.MailAddress(TextboxEmail.Text);
                    EditPlayer.DetailPlayer["Account"]["Email"] = TextboxEmail.Text;
                    EditPlayer.Save();
                }
                catch (Exception)
                {
                    TextboxEmail.Text = EditPlayer.DetailPlayer["Account"]["Email"].ToString();
                }
            };

            //action BTN control and change phone
            Textboxphone.LostFocus += (s, e) =>
            {
                if (long.TryParse(Textboxphone.Text, out long Handle))
                {
                    EditPlayer.DetailPlayer["Account"]["Phone"] = Handle;
                    EditPlayer.Save();
                }
                else
                {
                    DashboardGame.Notifaction("Can't Conver to Phone number", Notifaction.StatusMessage.Error);
                    Textboxphone.Text = EditPlayer.DetailPlayer["Account"]["Phone"].ToString();
                }
            };

            //action tag
            Tags.MouseDown += (s, e) =>
            {
                _ = new TagsSystem(EditPlayer.DetailPlayer["Account"]["Tags"].AsBsonArray, () =>
                {
                    TextCountTags.Text = EditPlayer.DetailPlayer["Account"]["Tags"].AsBsonArray.Count.ToString();
                    EditPlayer.Save();
                });
            };

            //action btn Email Recovery
            BTNSendEmailRecovery.MouseDown += async(s, e) =>
            {
                try
                {
                    new MailAddress(EditPlayer.DetailPlayer["Account"]["Email"].ToString());


                    if (await DashboardGame.DialogYesNo($"Do you want to send the recovery email to \"{EditPlayer.DetailPlayer["Account"]["Token"].AsObjectId}\"?") == MessageBoxResult.Yes)
                    {
                        try
                        {
                            SDK.SDK_PageDashboards.DashboardGame.PagePlayers.Recovery1(EditPlayer.DetailPlayer["Account"]["Token"].AsObjectId, new System.Net.Mail.MailAddress(EditPlayer.DetailPlayer["Account"]["Email"].AsString),
                                                                                       Code =>
                            {
                                if (Code != 0)
                                {
                                    DashboardGame.Dialog(Code.ToString(), "Recovery Code");
                                    PanelChangePassword.Visibility = System.Windows.Visibility.Visible;
                                }
                                else
                                {
                                    DashboardGame.Notifaction("Faild Send", Notifaction.StatusMessage.Error);
                                }
                            });
                        }
                        catch (Exception ex)
                        {
                            DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                        }
                    }
                    else
                    {
                        DashboardGame.Notifaction("Rejected", Notifaction.StatusMessage.Error);
                    }
                }
                catch (Exception)
                {
                    DashboardGame.Notifaction("The player does not have an email", Notifaction.StatusMessage.Error);
                }
            };

            //action btn Change Password
            BTNChangePassword.MouseDown += (s, e) =>
            {
                if (TextNewPassword.Text.Length >= 6)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PagePlayers.ChangePassword(EditPlayer.DetailPlayer["Account"]["Token"].AsObjectId, TextNewPassword.Text, Result =>
                    {
                        if (Result)
                        {
                            DashboardGame.Notifaction("Password Changed", Notifaction.StatusMessage.Ok);

                            TextNewPassword.Text           = "";
                            PanelChangePassword.Visibility = System.Windows.Visibility.Collapsed;
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Change Password", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Password Short", Notifaction.StatusMessage.Warrning);
                }
            };

            //copyToken
            TextToken.MouseDown += GlobalEvents.CopyText;

            //action btn Delete
            BTNDelete.MouseDown += (s, e) =>
            {
                EditPlayer.Delete(this);
            };

            #endregion

            #region PageLeaderboard
            //btn action leaderboards
            BTNAaddLeaderboardShow.MouseDown += (s, e) =>
            {
                ShowpanelAddLeaderboard();
            };

            //close panel leaderboard
            PanelAddLeaderboard.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffPanelLeaderboard();
                }
            };


            #endregion

            #region PageAchievements
            //action BTN Achievements
            BTNAchievements.Click += (s, e) =>
            {
                IniAchievements();
            };

            //action show panel Add achievements
            BTNShowPanelAddAchievement.MouseDown += (s, e) =>
            {
                ShowPanelAddAchievements();
            };

            //action Panel Achievements
            PanelAddAchievements.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowoffPaneladdAchievements();
                }
            };

            #endregion

            #region PageLogs

            //Init Logs
            BTNLogs.Click += (s, e) =>
            {
                InitLogs();
            };


            //action btn send log
            BTNSendLog.MouseDown += (s, e) =>
            {
                if (TextboxHeader.Text.Length >= 1 && TextboxDescription.Text.Length >= 1)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PagePlayers.AddLogPlayer(Editor.DetailPlayer["Account"]["Token"].AsObjectId, TextboxHeader.Text, TextboxDescription.Text, result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Log Added", Notifaction.StatusMessage.Ok);
                            InitLogs();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Add", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Header or Description Short", Notifaction.StatusMessage.Error);
                }
            };

            //action btn clear
            BTNClearLogs.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("All information will be lost.\nare you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PagePlayers.ClearLog(Editor.DetailPlayer["Account"]["Token"].AsObjectId, result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Logs Clear", Notifaction.StatusMessage.Ok);
                            InitLogs();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Clear", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Canceled", Notifaction.StatusMessage.Warrning);
                }
            };

            //action btn ClosePaneladdlog
            PanelAddLog.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowoffPaneladdLogs();
                }
            };

            //actin btn Add Log
            BTNAddLog.MouseDown += (s, e) =>
            {
                ShowPanelAddLogs();
            };

            //action btn see more
            BTNSeeMoreLog.MouseDown += (s, e) =>
            {
                Count += 100;
                TextSeeMoreNumber.Text = Count.ToString();
            };

            #endregion


            InitLeaderboards();
        }
Exemplo n.º 5
0
        public PageSetting()
        {
            InitializeComponent();
            CurentPage      = PageSettings;
            CurentBTNHeader = BTNSetting;

            #region PageSetting
            //fill frist Setting
            TextName.Text     = SettingUser.CurentDetailStudio["Name"].ToString();
            TextType.Text     = SettingUser.CurentDetailStudio["Type"].ToString();
            TextID.Text       = SettingUser.CurentDetailStudio["Token"].ToString();
            TextToken.Text    = SettingUser.CurentDetailStudio["Creator"].ToString();
            TextCreated.Text  = SettingUser.CurentDetailStudio["Created"].ToLocalTime().ToString();
            TextDatabase.Text = SettingUser.CurentDetailStudio["Database"].ToString();

            //copys
            TextToken.MouseDown    += GlobalEvents.CopyText;
            TextDatabase.MouseDown += GlobalEvents.CopyText;
            TextID.MouseDown       += GlobalEvents.CopyText;

            //action btn state
            BTNState.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.Status(
                    result =>
                {
                    var Text = "";
                    foreach (var item in result)
                    {
                        Text += item.Name + ": " + item.Value.ToString() + "\n";
                    }

                    DashboardGame.Dialog(Text, "Server State");
                },
                    () =>
                {
                    DashboardGame.Notifaction("Faild Recive", StatusMessage.Error);
                });
            };
            //action btn update
            BTNUpdate.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new SubPageUpdate.SubPageUpdate());
            };

            //action btn generateNew token
            BTNGeneretNewToken.MouseDown += async(s, e) =>
            {
                BTNGeneretNewToken.IsEnabled = false;

                if (await DashboardGame.DialogYesNo("Changing the current token causes a change in all studios \n are you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.GenerateNewToken(Result =>
                    {
                        if (Result)
                        {
                            DashboardGame.Notifaction("Token changed For more security please log in again", StatusMessage.Ok);

                            DashboardGame.Dashboard.Root.Children.Remove(this);
                            DashboardGame.Dashboard.Root.Children.Add(new Login());
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Change", StatusMessage.Error);
                            BTNGeneretNewToken.IsEnabled = true;
                        }
                    });
                }
                else
                {
                    BTNGeneretNewToken.IsEnabled = true;
                }
            };
            #endregion


            #region Page Monetize

            BTNPlayer.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Players"] = CurentMonetiz["Players"].AsInt32 + 1000;
                    NewMonetiz["Players"]    = NewMonetiz["Players"].AsInt32 + 1000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNLeaderboards.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Leaderboards"] = CurentMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Leaderboards"] = NewMonetiz["Leaderboards"].AsInt32 + 1;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;

                    BTNRevite.Visibility = Visibility.Visible;
                }
                Cheackcash();
                RechangeNew();
            };

            BTNAPIs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Apis"] = CurentMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Apis"] = NewMonetiz["Apis"].AsInt32 + 3000;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 20000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 20000;


                    BTNRevite.Visibility = Visibility.Visible;
                    Debug.WriteLine(CurentMonetiz.ToString());
                }
                Cheackcash();
                RechangeNew();
            };

            BTNLogs.MouseDown += (s, obj) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Logs"] = CurentMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Logs"] = NewMonetiz["Logs"].AsInt32 + 100;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 30000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 30000;


                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNAddAchievements.MouseDown += (s, e) =>
            {
                if (CurentMonetiz["Cash"].AsInt32 - 10000 >= 0)
                {
                    CurentMonetiz["Achievements"] = CurentMonetiz["Achievements"].AsInt32 + 2;

                    NewMonetiz["Achievements"] = NewMonetiz["Achievements"].AsInt32 + 2;

                    NewMonetiz["Cash"] = NewMonetiz["Cash"].AsInt32 + 10000;

                    CurentMonetiz["Cash"] = CurentMonetiz["Cash"].AsInt32 - 10000;


                    BTNRevite.Visibility = Visibility.Visible;
                }

                Cheackcash();
                RechangeNew();
            };

            BTNRevite.MouseDown += (s, obj) =>
            {
                NewMonetiz = new BsonDocument
                {
                    { "Players", 0 },
                    { "Leaderboards", 0 },
                    { "Apis", 0 },
                    { "Achievements", 0 },
                    { "Logs", 0 },
                    { "Cash", 0 }
                };

                //change curentmonetize to defult
                CurentMonetiz.Clear();
                foreach (var item in FristMonetiz)
                {
                    CurentMonetiz.Add(item.Name, item.Value);
                }

                BTNRevite.Visibility = Visibility.Collapsed;

                Cheackcash();
                RechangeNew();

                TextPlayerNewValue.Text       = "";
                TextLeaderboardsNewValue.Text = "";
                TextApisNewValue.Text         = "";
                TextLogsNewValue.Text         = "";
                TextAchievementsNewValue.Text = "";
            };

            //acatin btn pay/save
            BTNPay.MouseDown += async(s, obj) =>
            {
                if (NewMonetiz == CurentMonetiz)
                {
                    DashboardGame.Notifaction("Not Change", StatusMessage.Warrning);
                }
                else
                {
                    if (await DashboardGame.DialogYesNo($"\" {NewMonetiz["Cash"].AsInt32.ToString("#,##0") } \" Tomans will be deducted from your account credit \n Are you sure ? ") == MessageBoxResult.Yes)
                    {
                        var Detail = new BsonDocument
                        {
                            { "Leaderboards", CurentMonetiz["Leaderboards"].AsInt32 },
                            { "Apis", CurentMonetiz["Apis"].AsInt32 },
                            { "Logs", CurentMonetiz["Logs"].AsInt32 },
                            { "Achievements", CurentMonetiz["Achievements"].AsInt32 },
                            { "Players", CurentMonetiz["Players"].AsInt32 },
                            { "Creator", SettingUser.CurentDetailStudio["Creator"] },
                            { "Cash", CurentMonetiz["Cash"].AsInt32 }
                        };

                        SDK.SDK_PageDashboards.DashboardGame.PageStudios.AddPayment(Detail, ResultPay =>
                        {
                            if (ResultPay)
                            {
                                DashboardGame.Notifaction("Tanks for buy", StatusMessage.Ok);
                                ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());

                                TextPlayerNewValue.Text       = "";
                                TextLeaderboardsNewValue.Text = "";
                                TextApisNewValue.Text         = "";
                                TextLogsNewValue.Text         = "";
                                TextAchievementsNewValue.Text = "";
                                TextTomanNumber.Text          = "0";
                                BTNRevite.Visibility          = Visibility.Collapsed;


                                //log
                                SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Payment", $"{NewMonetiz["Cash"].AsInt32.ToString("#,##0") } \" Tomans will be deducted from your account credit", NewMonetiz, false, result => { });
                            }
                            else
                            {
                                DashboardGame.Notifaction("Fail Pay", StatusMessage.Error);
                            }
                        });
                    }
                    else
                    {
                        DashboardGame.Notifaction("Reject Pay", StatusMessage.Error);
                    }
                }
            };

            BTNPayments.MouseDown += (s, e) =>
            {
                DoubleAnimation Anim = new DoubleAnimation(0, 400, TimeSpan.FromSeconds(0.3));

                Storyboard.SetTargetProperty(Anim, new PropertyPath("Height"));
                Storyboard.SetTargetName(Anim, PaymentList.Name);

                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(Anim);
                storyboard.Begin(this);
            };

            BTNCollaps.MouseDown += (s, e) =>
            {
                ClosePaymentList();
            };



            //page Charge Wallet
            BTNAddMoney.MouseDown += (s, e) =>
            {
                DoubleAnimation Anim = new DoubleAnimation(0, 400, TimeSpan.FromSeconds(0.3));

                Storyboard.SetTargetProperty(Anim, new PropertyPath("Height"));
                Storyboard.SetTargetName(Anim, PanelChargeMoney.Name);

                Storyboard storyboard = new Storyboard();
                storyboard.Children.Add(Anim);
                storyboard.Begin(this);
            };
            BTNCloseCharge.MouseDown += (s, e) =>
            {
                CloseCharge();
            };


            //Page Buy money
            BTNPaytoBank.MouseDown += (s, e) =>
            {
                try
                {
                    if (TextAmount_BackToBank.Text.Length < 5 && int.Parse(TextAmount_BackToBank.Text) < 10000)
                    {
                        throw new Exception("The amount is below 10,000 Rials");
                    }

                    if (TextName_BackToBank.Text.Length < 2)
                    {
                        throw new Exception("The name is short");
                    }

                    _ = long.Parse(TextPhone_BackToBank.Text);
                    _ = int.Parse(TextAmount_BackToBank.Text);
                    _ = new MailAddress(TextEamil_BackToBank.Text);
                    if (TextDesc_BackToBank.Text.Length <= 1)
                    {
                        TextDesc_BackToBank.Text = "N/A";
                    }

                    var Request = new BsonDocument()
                    {
                        { "amount", int.Parse(TextAmount_BackToBank.Text) },
                        { "order_id", new Random().Next() },
                        { "name", TextName_BackToBank.Text },
                        { "phone", TextPhone_BackToBank.Text },
                        { "mail", TextEamil_BackToBank.Text },
                        { "desc", TextDesc_BackToBank.Text },
                        { "callback", "http://193.141.64.203/payments/callback" }
                    };

                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.OpenGatePaye(Request, result =>
                    {
                        if (result.ElementCount >= 1)
                        {
                            var Detail = new BsonDocument()
                            {
                                { "Request", Request },
                                { "DetailPay", result },
                                { "Detail", new BsonDocument {
                                      { "Studio", SettingUser.CurentDetailStudio["Database"] }, { "Token", SettingUser.Token }
                                  } }
                            };

                            SDK.SDK_PageDashboards.DashboardGame.PageStudios.AddPaytoList(Detail, async ResultAdd =>
                            {
                                if (ResultAdd)
                                {
                                    DashboardGame.Notifaction("You will be redirected to the payment page", StatusMessage.Ok);
                                    Process.Start(result["link"].AsString);

                                    var serilseDetailPay = new BsonDocument
                                    {
                                        { "id", result["id"] },
                                        { "order_id", Request["order_id"] }
                                    };

                                    var Result = new BsonDocument();

                                    while (true)
                                    {
                                        var Query = await SDK.SDK_PageDashboards.DashboardGame.PageStudios.CheackPay(serilseDetailPay);

                                        if (Query.ElementCount >= 1)
                                        {
                                            if (Query["status"].ToInt32() == 10)
                                            {
                                                SDK.SDK_PageDashboards.DashboardGame.PageStudios.VerifiePay(serilseDetailPay, ResultVerifiePay =>
                                                {
                                                    if (ResultVerifiePay)
                                                    {
                                                        DashboardGame.Notifaction("Payment is done.", StatusMessage.Ok);
                                                        ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                    }
                                                    else
                                                    {
                                                        DashboardGame.Notifaction("Payment failed.Please contact support", StatusMessage.Error);
                                                        ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                    }
                                                });
                                                break;
                                            }
                                            else if (Query["status"].ToInt32() == 7)
                                            {
                                                DashboardGame.Notifaction("Payment is Cancel", StatusMessage.Error);
                                                ReciveMonetize(PageMonetiz, new DependencyPropertyChangedEventArgs());
                                                CloseCharge();
                                                break;
                                            }
                                        }
                                        else
                                        {
                                            await Task.Delay(1);
                                        }
                                    }
                                }
                                else
                                {
                                    DashboardGame.Notifaction("Faild Pay", StatusMessage.Error);
                                }
                            });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Pay", StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, StatusMessage.Error);
                }
            };

            #endregion
        }