Esempio n. 1
0
        public ModelAchievements(BsonDocument DetailAchievement, IEditAchievements Editor)
        {
            InitializeComponent();

            //frist init
            TextToken.Text  = DetailAchievement["Token"].ToString();
            TextName.Text   = DetailAchievement["Name"].AsString;
            TextRecive.Text = DetailAchievement["Recive"].ToLocalTime().ToString();

            //action delete achievement
            BTNRemove.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("All Value in this section will be lost.  are you sure? ") == System.Windows.MessageBoxResult.Yes)
                {
                    DetailAchievement.Remove("Recive");

                    Editor.RemoveAchievements(DetailAchievement);
                }
                else
                {
                    DashboardGame.Notifaction("Canceled", Notifaction.StatusMessage.Warrning);
                }
            };


            //copy TOken
            TextToken.MouseDown += GlobalEvents.CopyText;
        }
Esempio n. 2
0
        public async void Delete(UserControl Editor)
        {
            if (await DashboardGame.DialogYesNo("All user information is lost \n Are you sure") == System.Windows.MessageBoxResult.Yes)
            {
                SDK.SDK_PageDashboards.DashboardGame.PagePlayers.Delete(DetailPlayer["Account"]["Token"].ToString(), result =>
                {
                    if (result)
                    {
                        DashboardGame.Notifaction("Deleted !", Notifaction.StatusMessage.Ok);

                        RefreshMainList();
                        DashboardGame.Dashboard.Root.Children.Remove(this);
                        DashboardGame.Dashboard.Root.Children.Remove(Editor);


                        //add log
                        SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Delete Player", $"You have deleted player \" {DetailPlayer["Account"]["Username"]} \"", DetailPlayer, false, resul => { });
                    }
                    else
                    {
                        DashboardGame.Notifaction("Faild Delete !", Notifaction.StatusMessage.Ok);
                    }
                });
            }
            else
            {
                DashboardGame.Notifaction("Delete Reject", Notifaction.StatusMessage.Ok);
            }
        }
Esempio n. 3
0
        public ModelContent(BsonDocument DetailContent)
        {
            InitializeComponent();
            this.DetailContent = DetailContent;

            Init();


            //copy text token
            TextToken.MouseDown += GlobalEvents.CopyText;

            //action btn View
            BTNView.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new JsonView(DetailContent["Content"].AsBsonDocument));
            };

            BTNEdit.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new EditContent.EditContent(this));
            };

            BTNDelete.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("All information is deleted.\nAre you sure ? ") == MessageBoxResult.Yes)
                {
                    Delete();
                }
                else
                {
                    DashboardGame.Notifaction("Rejected", Notifaction.StatusMessage.Warrning);
                }
            };
        }
Esempio n. 4
0
        public ModelAchivments(BsonDocument DetailAchievement, Action RefreshList)
        {
            InitializeComponent();
            TextName.Text    = DetailAchievement["Name"].AsString;
            TextToken.Text   = DetailAchievement["Token"].ToString();
            TextCreated.Text = DateTime.Parse(DetailAchievement["Created"].ToString()).ToString();
            TextValue.Text   = DetailAchievement["Value"].ToString();

            try
            {
                TextPercent.Text = ((DetailAchievement["Players"]["Achievements"].ToInt32() * 100) / DetailAchievement["TotalPlayer"].ToInt32()) + "%";
                TextPlayers.Text = DetailAchievement["Players"]["Achievements"].ToString();
            }
            catch (Exception)
            {
                TextPercent.Text = "0 %";
                TextPlayers.Text = "(0) No player received ";
            }


            BTNEdit.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new EditAchievements.EditAchievements(DetailAchievement, RefreshList));
            };

            BTNDelete.MouseDown += async(s, e) =>
            {
                DetailAchievement.Remove("Players");
                DetailAchievement.Remove("TotalPlayer");

                if (await DashboardGame.DialogYesNo("All settings and achievement players are removed \n are you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageAchievements.RemoveAchievements(DetailAchievement,
                                                                                             result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Deleted", StatusMessage.Ok);
                            RefreshList();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Delete", StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Reject", StatusMessage.Warrning);
                }
            };
        }
Esempio n. 5
0
        public ModelPlayersAchievements(BsonDocument DetailAchievements, BsonDocument DetailPlayer, Action RefreshList)
        {
            //frist init
            InitializeComponent();
            TextToken.Text    = DetailAchievements["Token"].ToString();
            TextUsername.Text = DetailAchievements["Username"].ToString() == "" ? "Not Set" : DetailAchievements["Username"].ToString();
            TextRecive.Text   = DetailAchievements["Recive"].ToLocalTime().ToString();

            //copy token
            TextToken.MouseDown += GlobalEvents.CopyText;

            //action remove
            BTNRemove.MouseDown += async(s, e) =>
            {
                System.Diagnostics.Debug.WriteLine(DetailPlayer);

                var SerilseDetailachievements = new BsonDocument
                {
                    { "Token", DetailAchievements["Token"] },
                    { "Name", DetailPlayer["Name"] },
                    { "Recive", DetailAchievements["Recive"] }
                };


                if (await DashboardGame.DialogYesNo("All information about this player achievement will be deleted \n Are you sure ? ") == System.Windows.MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageAchievements.RemoveAchievementsPlayer(DetailPlayer["Token"].AsObjectId, SerilseDetailachievements, result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Removed", Notifaction.StatusMessage.Ok);
                            RefreshList();

                            //add log
                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Remove player from achievement", $"Player \" {DetailPlayer["Token"]} \" was removed from the \" {DetailAchievements["Name"]} \" achievement", new BsonDocument {
                            }, false, resultLog => { });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Remove", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Reject", Notifaction.StatusMessage.Warrning);
                }
            };
        }
Esempio n. 6
0
        public ModelBackupAbstract(BsonDocument Detail)
        {
            InitializeComponent();
            this.Detail = Detail;

            TextVersion.Text = Detail["Settings"]["Token"].ToString();
            TextStart.Text   = Detail["Settings"]["Start"].ToLocalTime().ToString();
            TextEnd.Text     = Detail["Settings"]["End"].ToLocalTime().ToString();

            TextVersion.MouseDown += GlobalEvents.CopyText;

            BTNRemove.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("Information can not be undone") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.RemoveBackup(Detail["Settings"]["Token"].AsObjectId,
                                                                                      (Result) =>
                    {
                        (Parent as StackPanel).Children.Remove(this);

                        if (Result)
                        {
                            DashboardGame.Notifaction("Deleted !", Notifaction.StatusMessage.Ok);

                            //log
                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Delete Backup", $"Backup  \" {Detail["Settings"]["Token"].AsObjectId}\" deleted", new BsonDocument {
                            }, false, resultLog => { });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Cant Delete !", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Reject Delete", Notifaction.StatusMessage.Error);
                }
            };

            BTNDownload.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new ModelDownloadBackup(Detail));
            };
        }
Esempio n. 7
0
        public ModelStore(BsonDocument Detail)
        {
            InitializeComponent();
            DetailStore = Detail;

            Update();

            //action btn edit
            BTNEdit.MouseDown += (s, e) =>
            {
                DashboardGame.Dashboard.Root.Children.Add(new EditShop.EditShop(this));
            };

            //action show tag view
            Tags.MouseDown += (s, e) =>
            {
                new TagsSystem(Detail["Tags"].AsBsonArray);
            };

            //action btn delete
            BTNDelete.MouseDown += async(s, e) =>
            {
                Debug.WriteLine(Parent.GetType());
                if (await DashboardGame.DialogYesNo("All information will be lost Are you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageStore.RemoveStore(Detail, Result =>
                    {
                        if (Result)
                        {
                            DashboardGame.Notifaction("Store Deleted", Notifaction.StatusMessage.Ok);
                            (Parent as WrapPanel).Children.Remove(this);
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Delete", Notifaction.StatusMessage.Ok);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Canceled", Notifaction.StatusMessage.Warrning);
                }
            };
        }
Esempio n. 8
0
        public ContentValue(BsonDocument DetailValue, IEditorLeaderboard Editor)
        {
            InitializeComponent();

            TextToken.Text    = DetailValue["Leaderboards"]["Token"].ToString();
            TextUsername.Text = DetailValue["Leaderboards"]["Username"].ToString();
            TextValue.Text    = DetailValue["Leaderboards"]["Score"].ToString();
            TextRank.Text     = DetailValue["Rank"].ToString();

            TextToken.MouseDown += GlobalEvents.CopyText;

            BTNRemove.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("The value for the user is deleted \n Are you sure?") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Remove(DetailValue["Leaderboards"]["Token"].ToString(), DetailValue["Leaderboards"]["Leaderboard"].ToString(),
                                                                                () =>
                    {
                        Visibility = Visibility.Collapsed;
                        DashboardGame.Notifaction("Deleted", Notifaction.StatusMessage.Ok);

                        Editor.DetailLeaderboard["Settings"]["Count"] = (Editor.DetailLeaderboard["Settings"]["Count"].ToInt32() - 1);

                        Editor.Save();
                    },
                                                                                () =>
                    {
                        DashboardGame.Notifaction("Faild Delete", Notifaction.StatusMessage.Error);
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Delete reject", Notifaction.StatusMessage.Error);
                }
            };
        }
Esempio n. 9
0
        public PageSetting()
        {
            InitializeComponent();
            CurentPage      = PageSettings;
            CurentBTNHeader = BTNSetting;

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



            //action btn
            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;
                }
                Cheackcash();
                RechangeNew();
            };

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

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

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

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


                    BTNRevite.Visibility = Visibility.Visible;
                }
                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();
            };


            BTNRevite.MouseDown += (s, obj) =>
            {
                NewMonetiz = new BsonDocument
                {
                    { "Players", 0 },
                    { "Leaderboards", 0 },
                    { "Apis", 0 },
                    { "Studios", 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         = "";
                TextStudiosNewValue.Text      = "";
                TextLogsNewValue.Text         = "";
            };


            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", NewMonetiz["Leaderboards"].AsInt32 + CurentMonetiz["Leaderboards"].AsInt32 },
                            { "Apis", NewMonetiz["Apis"].AsInt32 + CurentMonetiz["Apis"].AsInt32 },
                            { "Studios", NewMonetiz["Studios"].AsInt32 + CurentMonetiz["Studios"].AsInt32 },
                            { "Logs", NewMonetiz["Logs"].AsInt32 + CurentMonetiz["Logs"].AsInt32 },
                            { "Players", NewMonetiz["Players"].AsInt32 + 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         = "";
                                TextStudiosNewValue.Text      = "";
                                TextLogsNewValue.Text         = "";
                                TextTomanNumber.Text          = "0";
                                BTNRevite.Visibility          = Visibility.Collapsed;
                            }
                            else
                            {
                                DashboardGame.Notifaction("Fail Pay", StatusMessage.Error);
                            }
                        });
                    }
                    else
                    {
                        DashboardGame.Notifaction("Reject Pay", StatusMessage.Error);
                    }
                }
            };
        }
Esempio n. 10
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();
        }
Esempio n. 11
0
        public EditLeaderboard(IEditorLeaderboard Editor)
        {
            InitializeComponent();

            #region Page Setting

            TextToken.Text           = Editor.DetailLeaderboard["Settings"]["Token"].AsObjectId.ToString();
            TextStart.Text           = DateTime.Parse(Editor.DetailLeaderboard["Settings"]["Start"].ToString()).ToString();
            TextLeaderboardName.Text = Editor.DetailLeaderboard["Settings"]["Name"].AsString;
            TextName_Setting.Text    = Editor.DetailLeaderboard["Settings"]["Name"].AsString;
            TextMinValue.Text        = Editor.DetailLeaderboard["Settings"]["Min"].ToString();
            TextMaxValue.Text        = Editor.DetailLeaderboard["Settings"]["Max"].ToString();

            ComboboxReset.SelectedIndex = Editor.DetailLeaderboard["Settings"]["Reset"].ToInt32();
            TextAmount.Text             = Editor.DetailLeaderboard["Settings"]["Amount"].ToString();

            ComboboxSort.SelectedIndex = Editor.DetailLeaderboard["Settings"]["Sort"].ToInt32();


            PanelAmount.Loaded += (s, e) =>
            {
                if (Editor.DetailLeaderboard["Settings"]["Reset"].ToInt32() == 0)
                {
                    PanelAmount.Visibility = Visibility.Collapsed;
                }
                else
                {
                    PanelAmount.Visibility = Visibility.Visible;
                }
            };


            //copy token
            TextToken.MouseDown += GlobalEvents.CopyText;

            //Control and Deploy amount
            TextAmount.LostFocus += (s, e) =>
            {
                try
                {
                    Editor.DetailLeaderboard["Settings"]["Amount"] = int.Parse(TextAmount.Text);
                    Editor.Save();
                }
                catch (Exception ex)
                {
                    Editor.DetailLeaderboard["Settings"]["Amount"] = 1;
                    TextAmount.Text = "1";
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                    Editor.Save();
                }
            };

            //change Minvalue
            TextMinValue.LostFocus += (s, e) =>
            {
                try
                {
                    Editor.DetailLeaderboard["Settings"]["Min"] = Int64.Parse(TextMinValue.Text);
                    Editor.Save();
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                    TextMinValue.Text = Editor.DetailLeaderboard["Settings"]["Min"].ToString();
                }
            };

            //change Max value
            TextMaxValue.LostFocus += (s, e) =>
            {
                try
                {
                    Editor.DetailLeaderboard["Settings"]["Max"] = Int64.Parse(TextMaxValue.Text);
                    Editor.Save();
                }
                catch (Exception ex)
                {
                    TextMaxValue.Text = Editor.DetailLeaderboard["Settings"]["Max"].ToString();
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };


            //change reset
            ComboboxReset.SelectionChanged += (s, e) =>
            {
                Editor.DetailLeaderboard["Settings"]["Reset"] = ComboboxReset.SelectedIndex;

                if (Editor.DetailLeaderboard["Settings"]["Reset"].ToInt32() == 0)
                {
                    PanelAmount.Visibility = Visibility.Collapsed;
                }
                else
                {
                    PanelAmount.Visibility = Visibility.Visible;
                }
                Editor.Save();
            };

            //change sort
            ComboboxSort.SelectionChanged += (s, e) =>
            {
                Editor.DetailLeaderboard["Settings"]["Sort"] = ComboboxSort.SelectedIndex;
                Editor.Save();
            };

            #endregion

            #region Page Leaderboard

            var Count = 100;
            //action btn recive leaderboards
            BTNLeaderboard.Click += (s, e) =>
            {
                Count = 100;
                ReciveLeaderboardDetail();
                TextSeeMore.Text = Count.ToString();
            };

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

            //action btn Backups
            BTNBackup.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Backup(Editor.DetailLeaderboard["Settings"]["Name"].ToString(), Result =>
                {
                    Debug.WriteLine(Result);
                });
            };

            //action  btn reset leaderboard
            BTNReset.MouseDown += async(s, e) =>
            {
                if (await DashboardGame.DialogYesNo("All information is lost.\n Are you sure ? ") == MessageBoxResult.Yes)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Reset(Editor.DetailLeaderboard["Settings"]["Name"].ToString(), result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Leaderboard Reset", Notifaction.StatusMessage.Ok);
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild reset", Notifaction.StatusMessage.Warrning);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Canceled", Notifaction.StatusMessage.Warrning);
                }
            };

            //action btn Show panel add
            BTNShowPanelAdd.MouseDown += (s, e) =>
            {
                ShowPanelAddPlayer();
            };

            //show off panel add
            PanelAddPlayer.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowoffPaneladdPlayer();
                }
            };

            //action btn add player
            BTNAddPlayer.MouseDown += (s, e) =>
            {
                try
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.AddPlayer(Editor.DetailLeaderboard["Settings"]["Name"].ToString(), ObjectId.Parse(TextboxTokenPlayer.Text), long.Parse(TextboxValue.Text),
                                                                                   result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Player Add", Notifaction.StatusMessage.Ok);
                            ReciveLeaderboardDetail();
                            ShowoffPaneladdPlayer();
                            Editor.DetailLeaderboard["Settings"]["Count"] = Editor.DetailLeaderboard["Settings"]["Count"].ToInt32() + 1;
                            Editor.Save();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild add", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };


            void ReciveLeaderboardDetail()
            {
                ContentPlaceLeaderboard.Children.Clear();
                SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Leaderboard(Count, Editor.DetailLeaderboard["Settings"]["Name"].ToString(), result =>
                {
                    if (result.ElementCount >= 1)
                    {
                        var Conter = 0;
                        foreach (var item in result["List"].AsBsonArray)
                        {
                            item.AsBsonDocument.Add("Rank", Conter);
                            ContentPlaceLeaderboard.Children.Add(new ContentValue(item.AsBsonDocument, Editor));
                            Conter++;
                        }
                    }
                    else
                    {
                        DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                        ShowPanelAddPlayer();
                    }
                });
            }

            #endregion

            #region Backups

            var CountBackups = 100;

            //btn backups
            BTNBackupHistory.Click += (s, e) =>
            {
                PlaceContentBackups.Children.Clear();
                SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.BackupRecive(Editor.DetailLeaderboard["Settings"]["Name"].ToString(), CountBackups, result =>
                {
                    if (result.ElementCount >= 1)
                    {
                        foreach (var item in result["Leaderboards"].AsBsonArray)
                        {
                            PlaceContentBackups.Children.Add(new ModelBackupAbstract(item.AsBsonDocument));
                        }
                    }
                    else
                    {
                        DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                    }
                });
            };

            #endregion
        }
Esempio n. 12
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
        }