Example #1
0
 private void SearchUsername(object sender, MouseButtonEventArgs e)
 {
     //cheack leght username
     if (TextBoxUsername_Search.Text.Length >= 6)
     {
         //recive detail
         SDK.SDK_PageDashboards.DashboardGame.PagePlayers.SearchUsername(TextBoxUsername_Search.Text,
                                                                         result =>
         {
             ChangeSearchTexts(result);
         },
                                                                         () =>
         {
             DashboardGame.Notifaction("Not Found", StatusMessage.Warrning);
         });
     }
     else
     {
         DashboardGame.Notifaction("Username Short(More than 6 charecter)", StatusMessage.Error);
     }
 }
Example #2
0
 private void SearchEmail(object sender, MouseButtonEventArgs e)
 {
     //cheack email valid
     try
     {
         _ = new System.Net.Mail.MailAddress(TextBoxEmail_Search.Text);
         SDK.SDK_PageDashboards.DashboardGame.PagePlayers.SearchEmail(TextBoxEmail_Search.Text,
                                                                      result =>
         {
             ChangeSearchTexts(result);
         },
                                                                      () =>
         {
             DashboardGame.Notifaction("Not Found", StatusMessage.Warrning);
         });
     }
     catch (Exception ex)
     {
         DashboardGame.Notifaction(ex.Message, StatusMessage.Error);
     }
 }
Example #3
0
        public static void CheackUpdate()
        {
            var a = new UIElement();

            SDK.SDK_PageDashboards.DashboardGame.PageDashboard.CheackUpdate(
                result =>
            {
                if (result.ElementCount >= 1)
                {
                    Version version = new Version(result["Version"].AsString);

                    if (version != Application.ResourceAssembly.GetName().Version)
                    {
                        DashboardGame.Dashboard.Root.Children.Add(new SubPageUpdate());
                    }
                }
            },
                () =>
            {
                DashboardGame.Notifaction("Faild Recive Update", Notifaction.StatusMessage.Error);
            });
        }
Example #4
0
 private void Add(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (TextNameLeaderboard.Text.Length >= 6)
     {
         SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Creat(TextNameLeaderboard.Text, ComboboxReset.SelectedIndex, ComboboxSort.SelectedIndex, Result =>
         {
             if (Result)
             {
                 DashboardGame.Notifaction("Leaderboard Added", StatusMessage.Ok);
                 Refreshlist(null, null);
             }
             else
             {
                 DashboardGame.Notifaction("Faild Add", StatusMessage.Error);
             }
         });
     }
     else
     {
         DashboardGame.Notifaction("Leaderboard name short ", StatusMessage.Warrning);
     }
 }
Example #5
0
        private void CheackUsername(object sender, TextChangedEventArgs e)
        {
            var Text = sender as TextBox;

            if (Text.Text.Length >= 6)
            {
                SDK.SDK_PageAUT.CheackUsername(Text.Text, result =>
                {
                    if (result)
                    {
                        Text.Text += new Random().Next();
                        DashboardGame.Notifaction("Username available", StatusMessage.Warrning);
                    }

                    Text.BorderBrush = new SolidColorBrush(Colors.LightGreen);
                });
            }
            else
            {
                Text.BorderBrush = new SolidColorBrush(Colors.Tomato);
            }
        }
Example #6
0
        public static bool ControllNumberFilde(TextBox Sender)
        {
            if (Sender.Text.Length >= 1)
            {
                try
                {
                    int.Parse(Sender.Text);

                    return(true);
                }
                catch (Exception)
                {
                    Sender.Text = "0";
                    DashboardGame.Notifaction("Field is Number", Dashboards.Dashboard_Game.Notifaction.StatusMessage.Error);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Example #7
0
        public void InitLeaderboards()
        {
            PlaceContentLeaderboard.Children.Clear();

            //init Player leaderboards
            SDK.SDK_PageDashboards.DashboardGame.PagePlayers.RecievePlayerLeaderboard(Editor.DetailPlayer["Account"]["Token"].AsObjectId, result =>
            {
                if (result.ElementCount >= 1)
                {
                    foreach (var item in result["Leaderboards"].AsBsonArray)
                    {
                        PlaceContentLeaderboard.Children.Add(new ModelLeaderboard.LeaderaboardPlayer(item["Leaderboard"].ToString(), item["Score"].ToInt64()));
                    }
                }
                else
                {
                    DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                }
            });

            //ini Studio Leaderboard
            SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Reciveleaderboards((Result) =>
            {
                PlaceLeaderboardStudio.Children.Clear();

                if (Result.ElementCount >= 1)
                {
                    foreach (var item in Result["List"].AsBsonArray)
                    {
                        PlaceLeaderboardStudio.Children.Add(new ModelLeaderboard.ModelLeaderboards(item.AsBsonDocument, this));
                    }
                }
                else
                {
                    DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                }
            });
        }
Example #8
0
        private void _Register(object sender, MouseButtonEventArgs e)
        {
            if (TextUsername.Text.Length >= 6 && TextPassword.Password.Length >= 6)
            {
                try
                {
                    new MailAddress(TextEmail.Text);

                    SDK.SDK_PageAUT.Register(TextUsername.Text, TextPassword.Password, TextEmail.Text, TextPhone.Text,
                                             (Token) =>
                    {
                        DashboardGame.Notifaction("Registered", StatusMessage.Ok);

                        Settings.Default._id = Token;
                        Settings.Default.Save();


                        //remove page and Effect
                        var _parent = (Parent as Grid);
                        _parent.Children.Remove(this);
                        (_parent.FindName("PageDashboard") as Grid).Effect = null;
                        InitDashbaord();
                    },
                                             () =>
                    {
                        DashboardGame.Notifaction("Faild to Register", StatusMessage.Error);
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, StatusMessage.Warrning);
                }
            }
            else
            {
                DashboardGame.Notifaction("Username or Password Short", StatusMessage.Error);
            }
        }
Example #9
0
        private void _Register(object sender, MouseButtonEventArgs e)
        {
            if (TextUsername.Text.Length >= 6 && TextPassword.Password.Length >= 6)
            {
                try
                {
                    new MailAddress(TextEmail.Text);

                    SDK.SDK_PageAUT.Register(TextUsername.Text, TextPassword.Password, TextEmail.Text, TextPhone.Text,
                                             (Token) =>
                    {
                        DashboardGame.Notifaction("Registered", StatusMessage.Ok);

                        Settings.Default._id = Token;
                        Settings.Default.Save();


                        //remove page and Effect
                        DashboardGame.Dashboard.Blure(false);
                        DashboardGame.Dashboard.Root.Children.Remove(this);

                        DashboardGame.Dashboard.Root.Children.Add(new SubPageStudios());
                    },
                                             () =>
                    {
                        DashboardGame.Notifaction("Faild to Register", StatusMessage.Error);
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, StatusMessage.Warrning);
                }
            }
            else
            {
                DashboardGame.Notifaction("Username or Password Short", StatusMessage.Error);
            }
        }
Example #10
0
        public void InitLogs()
        {
            Count = 100;
            TextSeeMoreNumber.Text = Count.ToString();

            SDK.SDK_PageDashboards.DashboardGame.PagePlayers.RecivePlayerlog(Editor.DetailPlayer["Account"]["Token"].AsObjectId, Count, result =>
            {
                PlaceContentLogs.Children.Clear();

                if (result.ElementCount >= 1)
                {
                    foreach (var item in result["Logs"].AsBsonArray)
                    {
                        PlaceContentLogs.Children.Add(new ModelLogPlayer(item.AsBsonDocument));
                    }
                }
                else
                {
                    ShowPanelAddLogs();
                    DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                }
            });
        }
Example #11
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);
                }
            };
        }
Example #12
0
        public void IniAchievements()
        {
            //ini Studio achievements
            SDK.SDK_PageDashboards.DashboardGame.PageAchievements.ReciveAchievements(result =>
            {
                ListStudioAchievement.Children.Clear();

                if (result.ElementCount >= 1)
                {
                    foreach (var item in result["Achievements"].AsBsonArray)
                    {
                        ListStudioAchievement.Children.Add(new ModelAchievementStudio(item.AsBsonDocument, this));
                    }
                }
                else
                {
                    DashboardGame.Notifaction("No Content", Notifaction.StatusMessage.Warrning);
                    ShowPanelAddAchievements();
                }
            });

            //init Player Achievements
            SDK.SDK_PageDashboards.DashboardGame.PageAchievements.PlayerAchievements(Editor.DetailPlayer["Account"]["Token"].AsObjectId, Result =>
            {
                PlaceContentAchievements.Children.Clear();


                if (Result.ElementCount >= 1)
                {
                    foreach (var item in Result["Achievements"].AsBsonArray)
                    {
                        PlaceContentAchievements.Children.Add(new ModelAchievements.ModelAchievements(item.AsBsonDocument, this));
                    }
                }
            });
        }
Example #13
0
        public PageAchievements()
        {
            InitializeComponent();
            ReciveListAchievements();

            //actions
            //action btnaddachivemenents
            BTNaddAchievements.MouseDown += (s, e) =>
            {
                try
                {
                    if (TextBoxName.Text.Length == 0)
                    {
                        throw new FormatException();
                    }

                    long.Parse(TextBoxValue.Text);

                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(Monetize =>
                    {
                        if (PlaceContentAchievements.Children.Count + 1 <= Monetize["Achievements"].ToInt32())
                        {
                            SDK.SDK_PageDashboards.DashboardGame.PageAchievements.AddAchievements(TextBoxName.Text, long.Parse(TextBoxValue.Text), result =>
                            {
                                ShowOffPanelAchievements();
                                ReciveListAchievements();

                                //add log
                                SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Creat achievement", $"\" {TextBoxName.Text} \" achievement was created", new BsonDocument(), false, resultlog => { });
                            });
                        }
                        else
                        {
                            DashboardGame.Notifaction("You can not create new achievements. Buy more achievements", Notifaction.StatusMessage.Error);
                        }
                    }, () => { });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };
            //action btnshow panel achievements
            BTNShowAddAchievment.MouseDown += (s, e) =>
            {
                ShowPanelAddChievements();
            };


            //action cheack name
            TextBoxName.TextChanged += (s, e) =>
            {
                var Text = s as TextBox;
                SDK.SDK_PageDashboards.DashboardGame.PageAchievements.CheackAchievements(Text.Text, result =>
                {
                    if (result)
                    {
                        Text.BorderBrush = new SolidColorBrush(Colors.Tomato);
                        DashboardGame.Notifaction($"\" {Text.Text} \" Duplicate name", Notifaction.StatusMessage.Error);
                        Text.Text += new Random().Next();
                        DashboardGame.Notifaction($"Rename to \" {Text.Text} \"", Notifaction.StatusMessage.Ok);
                    }
                    else
                    {
                        Text.BorderBrush = new SolidColorBrush(Colors.LightGreen);
                    }
                });
            };


            //close panel add
            PanelAddAchievement.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffPanelAchievements();
                }
            };
        }
Example #14
0
        public ModelFind(ObjectId TokenPlayer, BsonDocument Detail, Action Refreshlist, StackPanel PlaceListContentAchievements)
        {
            Background = new SolidColorBrush(Colors.White);

            Margin = new Thickness(5);
            Cursor = Cursors.Hand;


            var Name = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };
            var Value = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };
            var ID = new StackPanel()
            {
                Orientation = Orientation.Horizontal
            };

            Name.Children.Add(new TextBlock()
            {
                Text = "Name: ", FontWeight = FontWeights.Bold
            });
            Name.Children.Add(new TextBlock()
            {
                Text = Detail["Name"].ToString()
            });

            Value.Children.Add(new TextBlock()
            {
                Text = "Value: ", FontWeight = FontWeights.Bold
            });
            Value.Children.Add(new TextBlock()
            {
                Text = Detail["Value"].ToString()
            });

            ID.Children.Add(new TextBlock()
            {
                Text = "Token: ", FontWeight = FontWeights.Bold
            });
            ID.Children.Add(new TextBlock()
            {
                Text = Detail["Token"].ToString()
            });


            this.Detail = Detail;
            Children.Add(Name);
            Children.Add(Value);
            Children.Add(ID);
            Children.Add(new Border()
            {
                BorderBrush     = new SolidColorBrush(Colors.Gray),
                BorderThickness = new Thickness(0, 1, 0, 0)
            });


            //action select
            MouseDown += (s, e) =>
            {
                Detail.Remove("Players");
                Detail.Remove("Created");
                Detail.Remove("Value");


                SDK.SDK_PageDashboards.DashboardGame.PageAchievements.AddPlayerAchievements(TokenPlayer, Detail, result =>
                {
                    if (result)
                    {
                        DashboardGame.Notifaction("Achievement add to player", Notifaction.StatusMessage.Ok);
                        Refreshlist();
                    }
                    else
                    {
                        DashboardGame.Notifaction("Faild Add ", Notifaction.StatusMessage.Error);
                    }
                });
            };



            MouseEnter += (s, e) =>
            {
                Background = new SolidColorBrush(Colors.Gainsboro);
            };

            MouseLeave += (s, e) =>
            {
                Background = new SolidColorBrush(Colors.White);
            };
        }
Example #15
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
        }
Example #16
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();
        }
Example #17
0
        public PageRecoveryPassword()
        {
            InitializeComponent();

            //action btn login
            BTNLogin.MouseDown += (s, e) =>
            {
                var _parent = Parent as Grid;
                _parent.Children.Remove(this);
                _parent.Children.Add(new Login());
            };

            BTNStep1.MouseDown += (s, e) =>
            {
                try
                {
                    SDK.SDK_PageAUT.Recovery1(new System.Net.Mail.MailAddress(EmailStep1.Text), result =>
                    {
                        if (result)
                        {
                            Step1.Visibility = System.Windows.Visibility.Collapsed;
                            Step2.Visibility = System.Windows.Visibility.Visible;
                            DashboardGame.Notifaction($"Code send to Email {EmailStep1.Text}", Notifaction.StatusMessage.Ok);
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild send email recovery", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (System.Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };
            BTNStep2.MouseDown += (s, e) =>
            {
                try
                {
                    SDK.SDK_PageAUT.Recovery2(new System.Net.Mail.MailAddress(EmailStep1.Text), int.Parse(TextCode.Text), result =>
                    {
                        if (result)
                        {
                            Step2.Visibility = System.Windows.Visibility.Collapsed;
                            Step3.Visibility = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            DashboardGame.Notifaction("Verification code not match ", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (System.Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };

            BTNStep3.MouseDown += (s, e) =>
            {
                try
                {
                    if (TextPassword1.Password != TextPassword2.Password)
                    {
                        throw new System.Exception("Password Not Match");
                    }

                    SDK.SDK_PageAUT.Recovery3(new System.Net.Mail.MailAddress(EmailStep1.Text), int.Parse(TextCode.Text), TextPassword2.Password, Result =>
                    {
                        if (Result)
                        {
                            DashboardGame.Notifaction("Password Changed", Notifaction.StatusMessage.Ok);

                            var _parent = Parent as Grid;
                            _parent.Children.Remove(this);
                            _parent.Children.Add(new Login());
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Change ", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (System.Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };
        }
Example #18
0
        public PageKeyValue()
        {
            InitializeComponent();
            ReciveListAchievements();

            //Action show panel add Key
            BTNShowAddKey.MouseDown += (s, e) =>
            {
                ShowPanelAddChievements();
            };

            //acton Change Type
            ComboBoxType.SelectionChanged += (s, e) =>
            {
                TextBoxValue.IsEnabled = true;
                TextTotallValue.Text   = "";

                switch (ComboBoxType.SelectedIndex)
                {
                case 0:     //string
                {
                }
                break;

                case 1:     //int32
                {
                }
                break;

                case 2:     //int64
                {
                }
                break;

                case 3:     //boolean
                {
                }
                break;

                case 4:     //Token
                {
                    TextBoxValue.IsEnabled = false;
                    TextBoxValue.Text      = ObjectId.GenerateNewId().ToString();
                }
                break;

                default:
                    break;
                }
            };


            //action btn add
            BTNaddKeyValue.MouseDown += (s, e) =>
            {
                switch (ComboBoxType.SelectedIndex)
                {
                case 0:     //string
                {
                    Inject(new BsonElement(TextBoxKey.Text, TextBoxValue.Text));
                }
                break;

                case 1:     //int32
                {
                    try
                    {
                        Inject(new BsonElement(TextBoxKey.Text, Int32.Parse(TextBoxValue.Text)));
                    }
                    catch (Exception)
                    {
                        DashboardGame.Notifaction("The value is not a number", Notifaction.StatusMessage.Error);
                    }
                }
                break;

                case 2:     //int64
                {
                    try
                    {
                        Inject(new BsonElement(TextBoxKey.Text, Int64.Parse(TextBoxValue.Text)));
                    }
                    catch (Exception)
                    {
                        DashboardGame.Notifaction("The value is not a number", Notifaction.StatusMessage.Error);
                    }
                }
                break;

                case 3:     //boolean
                {
                    try
                    {
                        Inject(new BsonElement(TextBoxKey.Text, bool.Parse(TextBoxValue.Text)));
                    }
                    catch (Exception)
                    {
                        DashboardGame.Notifaction("The value is not a Boolean(true,false)", Notifaction.StatusMessage.Error);
                    }
                }
                break;

                case 4:     //Token
                {
                    Inject(new BsonElement(TextBoxKey.Text, TextBoxValue.Text));
                }
                break;

                default:
                    break;
                }

                void Inject(BsonElement Value)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageKeyValue.AddKey(Value, result =>
                    {
                        if (result)
                        {
                            ReciveListAchievements();
                            DashboardGame.Notifaction("Key Added", Notifaction.StatusMessage.Ok);
                        }
                        else
                        {
                            DashboardGame.Notifaction("Key Dublicated", Notifaction.StatusMessage.Warrning);
                        }
                        ShowOffPanelAchievements();
                    });
                }
            };

            //show off panel Add;
            PanelAddKey.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffPanelAchievements();
                }
            };
        }
Example #19
0
        public EditShop(IStoreSetting Settings)
        {
            #region Global

            InitializeComponent();

            this.Settings = Settings;
            DetailStore   = this.Settings.DetailStore;

            PageCurent = PanelSetting;
            BTNCurent  = BTNSetting;

            MouseMove += (s, e) =>
            {
                Focus();
            };
            #endregion


            #region Setting

            InitSetting();

            //controll and inject avatar
            TextAvatar.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinkImages(s) && TextAvatar.Text.Length >= 1)
                {
                    var Photo = new Image();

                    var ImageBit = new BitmapImage();

                    ImageBit.DownloadFailed += (s1, e1) =>
                    {
                        Settings.DetailStore["AvatarLink"] = "";
                        TextAvatar.Text = "";
                        DashboardGame.Notifaction("Image not found", Notifaction.StatusMessage.Error);

                        PlaceAvatar.Child = null;
                        PlaceAvatar.Child = new TextBlock()
                        {
                            Text                = "\xEB9F",
                            TextAlignment       = TextAlignment.Center,
                            VerticalAlignment   = VerticalAlignment.Center,
                            HorizontalAlignment = HorizontalAlignment.Center,
                            Foreground          = new SolidColorBrush(Colors.Black),
                            FontFamily          = new FontFamily("Segoe MDL2 Assets"),
                            FontSize            = 30,
                            ToolTip             = "No Avatar"
                        };
                    };

                    ImageBit.DownloadCompleted += (s2, e2) =>
                    {
                        Settings.DetailStore["AvatarLink"] = TextAvatar.Text;
                        PlaceAvatar.Child = null;
                        PlaceAvatar.Child = Photo;
                    };

                    ImageBit.BeginInit();
                    ImageBit.UriSource = new Uri(TextAvatar.Text, UriKind.Absolute);
                    Photo.Source       = ImageBit;

                    ImageBit.EndInit();
                }
                else
                {
                    if (TextAvatar.Text.Length == 0)
                    {
                        Settings.DetailStore["AvatarLink"] = TextAvatar.Text;
                    }
                }
            };
            //controll and inject name
            TextName.TextChanged += (s, e) =>
            {
                if (TextName.Text.Length >= 1)
                {
                    Settings.DetailStore["Name"] = TextName.Text;
                }
                else
                {
                    TextName.Text = Settings.DetailStore["Name"].AsString;
                    DashboardGame.Notifaction("Name is Short", Notifaction.StatusMessage.Error);
                }
            };
            //control and inject marketlink
            TextMarketLink.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinks(s))
                {
                    Settings.DetailStore["MarketLink"] = TextMarketLink.Text;
                }
            };
            //change Description
            TextDescription.TextChanged += (sender, e) =>
            {
                Settings.DetailStore["Description"] = TextDescription.Text;
            };

            //Active Control
            IsActive.Checked += (s, e) =>
            {
                this.Settings.DetailStore["IsActive"] = true;
            };
            IsActive.Unchecked += (s, e) =>
            {
                this.Settings.DetailStore["IsActive"] = false;
            };

            //acaton SaveSetting
            BTNSaveSetting.MouseDown += (s, e) =>
            {
                //control avatar
                if (GlobalEvents.ControllLinkImages(TextAvatar) && TextAvatar.Text.Length >= 1)
                {
                    Settings.DetailStore["AvatarLink"] = TextAvatar.Text;
                }
                else
                {
                    if (TextAvatar.Text.Length == 0)
                    {
                        Settings.DetailStore["AvatarLink"] = TextAvatar.Text;
                    }
                }


                //control link market
                if (GlobalEvents.ControllLinks(TextMarketLink))
                {
                    Settings.DetailStore["MarketLink"] = TextMarketLink.Text;
                }

                Settings.Save();
                InitSetting();
            };

            TextToken.MouseDown += GlobalEvents.CopyText;

            #endregion

            #region SubPage AddProducts

            //action show panel add product
            BTNShowPanelAdd.MouseDown += (s, e) =>
            {
                ShowPanelAddProduct();
            };

            //showoff panel add product
            PanelAddProduct.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowoffPanelAddProduct();
                }
            };

            //change name
            TextNameProduct_AddProduct.TextChanged += (s, e) =>
            {
                NewProduct["Name"] = TextNameProduct_AddProduct.Text;
            };

            //Change count int
            TextCount_AddProducts.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextCount_AddProducts))
                {
                    NewProduct["Count"] = TextCount_AddProducts.Text;
                }
                else
                {
                    NewProduct["Count"] = 0;
                }
            };

            //change Amount
            TextAmount_AddProducts.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextAmount_AddProducts))
                {
                    NewProduct["Amount"] = TextAmount_AddProducts.Text;
                }
                else
                {
                    NewProduct["Amount"] = 0;
                }
            };

            //Change Price
            TextPrice_AddProduct.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextPrice_AddProduct))
                {
                    NewProduct["Price"] = TextPrice_AddProduct.Text;
                }
                else
                {
                    NewProduct["Price"] = 0;
                }
            };

            //cheack Avatar
            TextAvatar_AddProduct.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinkImages(s))
                {
                    NewProduct["Avatar"] = TextAvatar_AddProduct.Text;
                }
            };

            //cheack market link
            TextMarketLink_AddProduct.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinks(s))
                {
                    NewProduct["Market"] = TextMarketLink_AddProduct.Text;
                }
            };

            //change description
            TextDescription_AddDescription.TextChanged += (s, e) =>
            {
                NewProduct["Description"] = TextDescription_AddDescription.Text;
            };


            // expire cheack
            IsExpiraton_AddProducts.Checked += (s, e) =>
            {
                Calendar_Expire_AddProducts.Visibility = Visibility.Visible;
                NewProduct["IsExpiration"]             = true;
            };
            IsExpiraton_AddProducts.Unchecked += (s, e) =>
            {
                Calendar_Expire_AddProducts.Visibility = Visibility.Collapsed;
                NewProduct["IsExpiration"]             = false;
            };

            //event open tag system
            TagSystem.MouseDown += (s, e) =>
            {
                new TagsSystem(NewProduct["Tags"].AsBsonArray, () =>
                {
                    TextTagsCount.Text = NewProduct["Tags"].AsBsonArray.Count.ToString();
                });
            };

            //cheack calender
            Calendar_Expire_AddProducts.SelectedDatesChanged += (s, e) =>
            {
                if (Calendar_Expire_AddProducts.SelectedDate > SettingUser.ServerTime)
                {
                    NewProduct["Expiration"] = Calendar_Expire_AddProducts.SelectedDate;
                }
                else
                {
                    NewProduct["Expiration"] = SettingUser.ServerTime.AddDays(3);
                }
            };

            //action btn add tag
            BTNAddProduct.MouseDown += (s, e) =>
            {
                NewProduct["Token"]   = ObjectId.GenerateNewId();
                NewProduct["Created"] = SettingUser.ServerTime;


                BsonDocument NewProduct1 = new BsonDocument
                {
                    { "Name", "" },
                    { "Count", 0 },
                    { "Amount", 0 },
                    { "Price", 0 },
                    { "Avatar", "" },
                    { "Market", "" },
                    { "Description", "" },
                    { "Tags", new BsonArray() },
                    { "IsExpiration", false },
                    { "Expiration", SettingUser.ServerTime.AddDays(3) },
                    { "Token", ObjectId.GenerateNewId() },
                    { "Created", SettingUser.ServerTime }
                };

                this.Settings.DetailStore["Products"].AsBsonArray.Add(NewProduct);
                this.Settings.Save();
                ShowoffPanelAddProduct();
                InitSetting();
                ReciveProduct();
                NewProduct = NewProduct1;
            };
            #endregion
        }
Example #20
0
        public ModelKeyValue(BsonElement Detail, Action Refresh)
        {
            InitializeComponent();
            TextName.Text     = Detail.Name;
            TextValue.Text    = Detail.Value.ToString();
            TextBoxKey.Text   = Detail.Name;
            TextBoxValue.Text = Detail.Value.ToString();


            //action delete key
            BTNDelete.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageKeyValue.RemoveKeys(Detail.Name, result =>
                {
                    if (result)
                    {
                        Refresh();
                    }
                    else
                    {
                        DashboardGame.Notifaction("Faild Delte", Notifaction.StatusMessage.Error);
                    }
                });
            };

            //action BTNEdit
            BTNEdit.MouseDown += (s, e) =>
            {
                Root.Visibility     = Visibility.Collapsed;
                RootEdit.Visibility = Visibility.Visible;
            };


            //action btnBack
            BTNBack.MouseDown += (s, e) =>
            {
                Root.Visibility     = Visibility.Visible;
                RootEdit.Visibility = Visibility.Collapsed;
            };


            //Action btn Save
            BTNSave.MouseDown += (s, e) =>
            {
                if (TextBoxValue.Text.Length >= 1 && TextBoxKey.Text.Length >= 1)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageKeyValue.UpdateKeys(TextBoxKey.Text, TextBoxValue.Text.ToString(), result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Key Updated", Notifaction.StatusMessage.Ok);
                            Refresh();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Update Faild", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Key or Value Short", Notifaction.StatusMessage.Error);
                }
            };
        }
Example #21
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);
                    }
                }
            };
        }
Example #22
0
        public InternalNotifaction()
        {
            InitializeComponent();

            ReciveLogs();

            //reload list
            BTNReload.MouseDown += (s, o) =>
            {
                ReciveLogs();
            };

            //remove all Notifaction in seces
            BTNDeleteAllView.MouseDown += (o, s) =>
            {
                foreach (var item in Notifactions)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageLog.DeleteLog(item.Detail, resultDelete =>
                    {
                        if (resultDelete)
                        {
                            PlaceContentNotifacction.Children.Remove(item);
                        }
                    });

                    ReciveLogs();
                }
                ;
            };

            //++ countnotifaction
            BTNReciveMore.MouseDown += (o, s) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(result =>
                {
                    if (CountNotifaction + 10 <= result["Logs"].ToInt32())
                    {
                        CountNotifaction += 10;
                        ReciveLogs();
                    }
                    else
                    {
                        TextHistoryCount.Text += $" \\ {result["Logs"]}";
                        DashboardGame.Notifaction($"The value \"{result["Logs"]}\" can be read from history. To see more of Payments Buy Now!", Notifaction.StatusMessage.Warrning);
                    }
                }, () => { });
            };

            CloseArea.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    DoubleAnimation Opacity = new DoubleAnimation();
                    Opacity.From       = 1;
                    Opacity.To         = 0;
                    Opacity.Duration   = new Duration(TimeSpan.FromSeconds(0.3));
                    Opacity.Completed += (o, ss) =>
                    {
                        Close(null, null);
                    };

                    Storyboard.SetTargetName(Opacity, Root.Name);
                    Storyboard.SetTargetProperty(Opacity, new PropertyPath("Opacity"));

                    Storyboard MyStory = new Storyboard();

                    MyStory.Children.Add(Opacity);
                    MyStory.Begin(this);
                }
            };

            //mark Notifaction as read
            SDK.SDK_PageDashboards.DashboardGame.PageLog.MarkNotifactionasRead(result =>
            {
                if (result)
                {
                    ReciveLogs();
                }
                else
                {
                }
            });
        }
Example #23
0
        public PageLeaderboard()
        {
            InitializeComponent();

            ReciveLeaderboards();



            #region SubPage Add Leaderboard

            BTNAddLeaderboard.MouseDown += (s, e) =>
            {
                if (TextNameLeaderboard.Text.Length >= 6)
                {
                    SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(result =>
                    {
                        if (PlaceLeaderboard.Children.Count + 1 <= result["Leaderboards"].ToInt32())
                        {
                            try
                            {
                                //amount not 0
                                if (int.Parse(TextAmount.Text) == 0)
                                {
                                    TextAmount.Text = 1.ToString();
                                }


                                SDK.SDK_PageDashboards.DashboardGame.PageLeaderboard.Creat(TextNameLeaderboard.Text, ComboboxReset.SelectedIndex, Int64.Parse(TextAmount.Text), ComboboxSort.SelectedIndex, int.Parse(TextMinValue.Text), Int64.Parse(TextMaxValue.Text), Result =>
                                {
                                    if (Result)
                                    {
                                        DashboardGame.Notifaction("Leaderboard Added", Notifaction.StatusMessage.Ok);
                                        ShowOffSubpageAddLeaderboard();
                                        ReciveLeaderboards();
                                    }
                                    else
                                    {
                                        DashboardGame.Notifaction("Faild Add", Notifaction.StatusMessage.Error);
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                TextMinValue.Text = 0.ToString();
                                TextMaxValue.Text = 10000.ToString();
                                TextAmount.Text   = 1.ToString();
                                DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                            }
                        }
                        else
                        {
                            DashboardGame.Notifaction("You can not add more Leaderboard.See Payments to buy a leaderboard.", Notifaction.StatusMessage.Warrning);
                        }
                    }, () => { });
                }
                else
                {
                    DashboardGame.Notifaction("Leaderboard name short ", Notifaction.StatusMessage.Warrning);
                }
            };

            BTNShowPanelAddLeaderboards.MouseDown += (s, e) =>
            {
                ShowSubpageAddLeaderboard();
            };

            PanelAddLeaderboard.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffSubpageAddLeaderboard();
                }
            };

            ComboboxReset.SelectionChanged += (s, e) =>
            {
                ChangeAmount();
            };

            #endregion
        }
Example #24
0
        public Login()
        {
            InitializeComponent();

            //blure Controll
            DashboardGame.Dashboard.Blure(true);
            Unloaded += (s, e) =>
            {
                DashboardGame.Dashboard.Blure(false);
            };

            //action btn login
            BTNLogin.MouseDown += (s, e) =>
            {
                BTNLogin.IsEnabled = false;

                if (TextUsername.Text.Length >= 6 && TextPassword.Password.Length >= 6)
                {
                    SDK.SDK_PageAUT.Login(TextUsername.Text, TextPassword.Password, (resul, Token) =>
                    {
                        if (resul)
                        {
                            //login
                            DashboardGame.Notifaction("Logined", Notifaction.StatusMessage.Ok);
                            Settings.Default._id = Token;
                            Settings.Default.Save();

                            //remove page and Effect
                            DashboardGame.Dashboard.Root.Children.Remove(this);
                            DashboardGame.Dashboard.Blure(true);

                            DashboardGame.Dashboard.Root.Children.Add(new SubPageStudios());
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Login", Notifaction.StatusMessage.Error);
                            BTNLogin.IsEnabled = true;
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Username or Password Short", Notifaction.StatusMessage.Error);
                    BTNLogin.IsEnabled = true;
                }
            };

            //action btn register
            BTNRegister.MouseDown += (s, e) =>
            {
                var _Parent = (Parent as Grid);
                _Parent.Children.Remove(this);
                _Parent.Children.Add(new Register());
            };

            //action  btn recovery
            BTNRecovery.MouseDown += (s, e) =>
            {
                var _Parent = (Parent as Grid);
                _Parent.Children.Remove(this);
                _Parent.Children.Add(new PageRecoveryPassword());
            };
        }
Example #25
0
        private void ReciveMonetize(object sender, DependencyPropertyChangedEventArgs e)
        {
            if ((sender as Grid).Visibility == Visibility.Visible)
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(
                    result =>
                {
                    //Fill Payment
                    ContentPlacePay.Children.Clear();
                    foreach (var item in result["PaymentList"].AsBsonArray)
                    {
                        ContentPlacePay.Children.Add(new ModelPayment(item.AsBsonDocument));
                    }

                    //fill CurentMonetiz  & Frist monetiz
                    CurentMonetiz.Clear();
                    FristMonetiz.Clear();
                    foreach (var item in result)
                    {
                        CurentMonetiz.Add(item.Name, item.Value);

                        FristMonetiz.Add(item.Name, item.Value);
                    }

                    NewMonetiz = new BsonDocument
                    {
                        { "Players", 0 },
                        { "Leaderboards", 0 },
                        { "Apis", 0 },
                        { "Studios", 0 },
                        { "Logs", 0 },
                        { "Cash", 0 }
                    };

                    ReChange();
                    Cheackcash();

                    //frist insert
                    void ReChange()
                    {
                        //players
                        if (result["Players"].AsInt32 <= 999)
                        {
                            TextPlayerValue.Text = result["Players"].ToString();
                        }
                        else if (result["Players"].AsInt32 >= 1000 && result["Players"].AsInt32 <= 999999)
                        {
                            TextPlayerValue.Text = (result["Players"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Players"].AsInt32 >= 1000000)
                        {
                            TextPlayerValue.Text = (result["Players"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Leaderboard
                        if (result["Leaderboards"].AsInt32 <= 999)
                        {
                            TextLeaderboardsValue.Text = result["Leaderboards"].ToString();
                        }
                        else if (result["Leaderboards"].AsInt32 >= 1000 && result["Leaderboards"].AsInt32 <= 999999)
                        {
                            TextLeaderboardsValue.Text = (result["Leaderboards"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Leaderboards"].AsInt32 >= 1000000)
                        {
                            TextLeaderboardsValue.Text = (result["Players"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Apis
                        if (result["Apis"].AsInt32 <= 999)
                        {
                            TextApisValue.Text = result["Apis"].ToString();
                        }
                        else if (result["Apis"].AsInt32 >= 1000 && result["Apis"].AsInt32 <= 999999)
                        {
                            TextApisValue.Text = (result["Apis"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Apis"].AsInt32 >= 1000000)
                        {
                            TextApisValue.Text = (result["Apis"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Studios
                        if (result["Studios"].AsInt32 <= 999)
                        {
                            TextStudiosValue.Text = result["Studios"].ToString();
                        }
                        else if (result["Studios"].AsInt32 >= 1000 && result["Studios"].AsInt32 <= 999999)
                        {
                            TextStudiosValue.Text = (result["Studios"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Studios"].AsInt32 >= 1000000)
                        {
                            TextStudiosValue.Text = (result["Studios"].AsInt32 / 1000000).ToString() + "M";
                        }

                        //Logs
                        if (result["Logs"].AsInt32 <= 999)
                        {
                            TextLogsValue.Text = result["Logs"].ToString();
                        }
                        else if (result["Logs"].AsInt32 >= 1000 && result["Logs"].AsInt32 <= 999999)
                        {
                            TextLogsValue.Text = (result["Logs"].AsInt32 / 1000).ToString() + "K";
                        }
                        else if (result["Logs"].AsInt32 >= 1000000)
                        {
                            TextLogsValue.Text = (result["Logs"].AsInt32 / 1000000).ToString() + "M";
                        }


                        TextCash.Text = result["Cash"].AsInt32.ToString("#,##0") + " T";

                        if (result["Cash"] <= 0)
                        {
                            TextNoCash.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            TextNoCash.Visibility = Visibility.Collapsed;
                        }

                        Cheackcash();
                    }
                },
                    () =>
                {
                    DashboardGame.Notifaction("Faild Recive", Notifaction.StatusMessage.Error);
                });
            }
        }
Example #26
0
        public PageShop()
        {
            InitializeComponent();

            ReciveStores();

            //acaton add Store
            BTNaddStore.MouseDown += (s, e) =>
            {
                try
                {
                    if (TextboxName.Text.Length <= 5)
                    {
                        throw new Exception("Store name Short");
                    }

                    if (TextBoxMarketLink.Text.Length >= 1)
                    {
                        try
                        {
                            new Uri(TextBoxMarketLink.Text);
                        }
                        catch (Exception)
                        {
                            DashboardGame.Notifaction("The \" Market link \" is incorrect", Notifaction.StatusMessage.Error);
                        }
                    }


                    if (TextBoxAvatar.Text.Length >= 1)
                    {
                        try
                        {
                            new Uri(TextBoxAvatar.Text);
                        }
                        catch (Exception ex)
                        {
                            DashboardGame.Notifaction("The \" Avatar link \" is incorrect", Notifaction.StatusMessage.Error);
                        }
                    }


                    Detail["Name"]        = TextboxName.Text;
                    Detail["Description"] = TextBoxDescription.Text;
                    Detail["MarketLink"]  = TextBoxMarketLink.Text;
                    Detail["AvatarLink"]  = TextBoxAvatar.Text;
                    Detail["IsActive"]    = CheackboxActivity.IsChecked.Value;

                    SDK.SDK_PageDashboards.DashboardGame.PageStore.AddStore(Detail, result =>
                    {
                        if (result)
                        {
                            DashboardGame.Notifaction("Store Added", Notifaction.StatusMessage.Ok);
                            ReciveStores();
                            ShowOffSubpageAddStore();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Add", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };

            //action close
            PanelAddStore.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffSubpageAddStore();
                }
            };


            #region AddStore

            //btn show panel add store
            BTNShowPanelStore.MouseDown += (s, e) =>
            {
                ShowSubpageAddStore();
            };

            //action btn show tag system
            Tags.MouseDown += (s, e) =>
            {
                new TagsSystem(Detail["Tags"].AsBsonArray, () =>
                {
                    TextTagCount.Text = Detail["Tags"].AsBsonArray.Count.ToString();
                });
            };
            #endregion
        }
Example #27
0
        public EditAchievements(BsonDocument DetailAchievement, Action RefreshList)
        {
            InitializeComponent();
            this.DetailAchievements = DetailAchievement;

            CurentPage = ContentSetting;
            CurentTab  = BTNSetting;

            TextAchievementsID.Text = DetailAchievement["Name"].ToString();
            TextValue.Text          = DetailAchievement["Value"].ToString();
            TextCreated.Text        = DetailAchievement["Created"].ToLocalTime().ToString();
            TextToken.Text          = DetailAchievement["Token"].ToString();

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


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

            //action btnsave
            BTNSaveSetting.MouseDown += (s, e) =>
            {
                try
                {
                    long.Parse(TextValue.Text);

                    DetailAchievement["Value"] = long.Parse(TextValue.Text);

                    SDK.SDK_PageDashboards.DashboardGame.PageAchievements.EditAchievements(DetailAchievement["Token"].AsObjectId, DetailAchievement, result =>
                    {
                        if (result)
                        {
                            RefreshList();
                            DashboardGame.Notifaction("Updated", Notifaction.StatusMessage.Ok);

                            //add log
                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("modified achievement", $"Modify achievement  \" {DetailAchievement["Name"] } \" ", DetailAchievement, false, resultLog => { });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Update", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };


            BTNShowPanelAdd.MouseDown += (s, e) =>
            {
                ShowPaneladdPlayer();
            };

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

            //actin add player to achievements
            BTNAddPlayer.MouseDown += (s, e) =>
            {
                try
                {
                    var SerilseDetail = new BsonDocument
                    {
                        { "Token", DetailAchievement["Token"] },
                        { "Name", DetailAchievement["Name"] },
                    };

                    SDK.SDK_PageDashboards.DashboardGame.PageAchievements.AddPlayerAchievements(ObjectId.Parse(TextboxTokenPlayer.Text), SerilseDetail, result =>
                    {
                        if (result)
                        {
                            ShowoffPaneladdPlayer();
                            ReciveList();

                            //add log
                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Add player to achievement", $"Player \" {TextboxTokenPlayer.Text} \" was added to the achievement of \" {DetailAchievement["Name"]} \"", new BsonDocument {
                            }, false, resultLog => { });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Add", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                catch (Exception ex)
                {
                    DashboardGame.Notifaction(ex.Message, Notifaction.StatusMessage.Error);
                }
            };

            //actin btn refresh
            BTNRefresh.MouseDown += (s, e) =>
            {
                ReciveList();
            };

            //action  inc countlist
            BTNSeeMore.MouseDown += (s, e) =>
            {
                CountList       += 100;
                TextSeeMore.Text = CountList.ToString();
                ReciveList();
            };

            //refresh base list for edit setting
            Unloaded += (s, e) =>
            {
                RefreshList();
            };
        }
Example #28
0
        public SubpageSupport()
        {
            InitializeComponent();

            //init btnsener //send support
            BTNAddSupport.MouseDown += (o, s) =>
            {
                if (TextboxTitle.Text.Length >= 1 && TextDescription.Text.Length >= 1)
                {
                    var Detailsupport = new BsonDocument
                    {
                        { "Header", TextboxTitle.Text },
                        { "Priority", ComboBoxPriority.SelectedIndex },
                        { "Part", ComboBoxPart.SelectedIndex },
                        { "Description", TextDescription.Text },
                        { "IsReport", false }
                    };
                    SDK.SDK_PageDashboards.DashboardGame.PageSupport.AddSupport(Detailsupport, result =>
                    {
                        if (result)
                        {
                            ReciveSupportList();
                            OpenPageQuestions(null, null);
                            DashboardGame.Notifaction("Support Add \n You will receive the answer soon", Notifaction.StatusMessage.Ok);

                            TextDescription.Text = null;
                            TextboxTitle.Text    = null;

                            //log
                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Support Created", $"You created the \"{Detailsupport["Header"]}\" ticket", Detailsupport, false, (R) => { });
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild add", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Description or Titel Short", Notifaction.StatusMessage.Warrning);
                }
            };

            //init btnReload
            BTNReload.MouseDown += (s, e) =>
            {
                ReciveSupportList();
                OpenPageQuestions(null, null);
            };


            BTNSendMessage.MouseDown += (s, e) =>
            {
                if (TextMessage.Text.Length >= 1)
                {
                    BsonDocument DetailMessage = new BsonDocument
                    {
                        { "Message", TextMessage.Text },
                        { "Sender", 0 }
                    };

                    SDK.SDK_PageDashboards.DashboardGame.PageSupport.AddMessage(CurentSupport["Token"].AsObjectId, DetailMessage, result =>
                    {
                        if (result)
                        {
                            DetailMessage.Add("Created", DateTime.Now);

                            ReciveSupportList();

                            PlaceContentMessages.Children.Add(new ModelMessage(DetailMessage));
                            DashboardGame.Notifaction("Message Send to Support", Notifaction.StatusMessage.Ok);

                            //Cheack Support notifaction
                            DashboardGame.ReciveManuallNotifaction();
                        }
                        else
                        {
                            DashboardGame.Notifaction("Faild Send", Notifaction.StatusMessage.Error);
                        }
                    });
                }
                else
                {
                    DashboardGame.Notifaction("Message To Short", Notifaction.StatusMessage.Error);
                }
            };


            ReciveSupportList();
        }
Example #29
0
        public ModelProduct(BsonDocument DetailProduct, IEditStore setting)
        {
            InitializeComponent();

            MainSetting        = setting;
            this.DetailProduct = DetailProduct;

            var image        = new Image();
            var fullFilePath = this.DetailProduct["Avatar"].ToString();

            if (this.DetailProduct["Avatar"].ToString().Length >= 1)
            {
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();
                bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute);
                bitmap.EndInit();

                image.Source      = bitmap;
                PlaceAvatar.Child = image;
            }
            else
            {
                PlaceAvatar.Child = new TextBlock()
                {
                    Text                = "\xEB9F",
                    TextAlignment       = TextAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    Foreground          = new SolidColorBrush(Colors.Black),
                    FontFamily          = new FontFamily("Segoe MDL2 Assets"),
                    FontSize            = 30,
                    ToolTip             = "No Avatar"
                };
            }


            TextCreated.Text = this.DetailProduct["Created"].ToLocalTime().ToString();

            TextToken.Text       = this.DetailProduct["Token"].ToString();
            TextToken.MouseDown += GlobalEvents.CopyText;

            TextName.Text        = this.DetailProduct["Name"].ToString();
            TextAvatarLink.Text  = this.DetailProduct["Avatar"].ToString();
            TextDescription.Text = this.DetailProduct["Description"].ToString();
            TextCount.Text       = this.DetailProduct["Count"].ToString();
            TextAmount.Text      = this.DetailProduct["Amount"].ToString();
            TextPrice.Text       = this.DetailProduct["Price"].ToString();
            TextTags.Text        = this.DetailProduct["Tags"].AsBsonArray.Count.ToString();
            if (this.DetailProduct["IsExpiration"].AsBoolean)
            {
                IsExpiration.IsChecked = true;
                Calender.Visibility    = Visibility.Visible;
            }
            else
            {
                IsExpiration.IsChecked = false;
                Calender.Visibility    = Visibility.Collapsed;
            }

            TextExpiration.Text   = this.DetailProduct["Expiration"].ToUniversalTime().Date.ToString();
            Calender.SelectedDate = DetailProduct["Expiration"].ToUniversalTime();



            //action expiration
            IsExpiration.Checked += (s, e) =>
            {
                Calender.Visibility = Visibility.Visible;
                this.DetailProduct["IsExpiration"] = true;
                UpdateProduct();
            };
            IsExpiration.Unchecked += (s, e) =>
            {
                Calender.Visibility = Visibility.Collapsed;
                this.DetailProduct["IsExpiration"] = false;
                UpdateProduct();
            };
            //actionTags
            Tags.MouseDown += (s, e) =>
            {
                new TagsSystem(this.DetailProduct["Tags"].AsBsonArray, () =>
                {
                    UpdateProduct();
                    TextTags.Text = this.DetailProduct["Tags"].AsBsonArray.Count.ToString();
                });
            };


            //change name
            TextName.TextChanged += (s, e) =>
            {
                if (TextName.Text.Length >= 1)
                {
                    this.DetailProduct["Name"] = TextName.Text;
                    UpdateProduct();
                }
                else
                {
                    DashboardGame.Notifaction("Name Is Short", Notifaction.StatusMessage.Error);
                }
            };
            //change avatar
            TextAvatarLink.LostFocus += (s, e) =>
            {
                if (GlobalEvents.ControllLinkImages(s))
                {
                    BitmapImage bitmap = new BitmapImage();
                    bitmap.DownloadFailed += (s1, e1) =>
                    {
                        this.DetailProduct["Avatar"] = "";
                        UpdateLayout();

                        PlaceAvatar.Child = null;

                        PlaceAvatar.Child = new TextBlock()
                        {
                            Text                = "\xEB9F",
                            TextAlignment       = TextAlignment.Center,
                            VerticalAlignment   = VerticalAlignment.Center,
                            HorizontalAlignment = HorizontalAlignment.Center,
                            Foreground          = new SolidColorBrush(Colors.Black),
                            FontFamily          = new FontFamily("Segoe MDL2 Assets"),
                            FontSize            = 30,
                            ToolTip             = "No Avatar"
                        };
                    };

                    bitmap.BeginInit();
                    bitmap.UriSource = new Uri(TextAvatarLink.Text, UriKind.Absolute);
                    bitmap.EndInit();
                    image.Source      = bitmap;
                    PlaceAvatar.Child = image;

                    this.DetailProduct["Avatar"] = TextAvatarLink.Text;
                    UpdateLayout();
                }

                UpdateProduct();
            };
            //change Description
            TextDescription.TextChanged += (s, e) =>
            {
                this.DetailProduct["Description"] = TextDescription.Text;
                UpdateProduct();
            };
            //change Count
            TextCount.TextChanged += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextCount))
                {
                    this.DetailProduct["Count"] = int.Parse(TextCount.Text);
                }

                UpdateProduct();
            };
            //change amount
            TextAmount.TextChanged += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextAmount))
                {
                    this.DetailProduct["Amount"] = int.Parse(TextAmount.Text);
                }
                UpdateProduct();
            };
            //change Price
            TextPrice.TextChanged += (s, e) =>
            {
                if (GlobalEvents.ControllNumberFilde(TextPrice))
                {
                    this.DetailProduct["Price"] = int.Parse(TextPrice.Text);
                }
                UpdateProduct();
            };
            //cahge calender
            Calender.SelectedDatesChanged += (s, e) =>
            {
                if (Calender.SelectedDate > SettingUser.ServerTime)
                {
                    this.DetailProduct["Expiration"] = Calender.SelectedDate;
                    TextExpiration.Text = this.DetailProduct["Expiration"].ToUniversalTime().Date.ToString();
                }
                else
                {
                    DashboardGame.Notifaction("Time must be in the future", Notifaction.StatusMessage.Error);
                }
            };

            //action save Setting
            BTNSave.MouseDown += (s, e) =>
            {
                setting.SaveSetting();
            };

            BTNDelete.MouseDown += (s, e) =>
            {
                setting.DetailStore["Products"].AsBsonArray.Remove(DetailProduct);
                (Parent as StackPanel).Children.Remove(this);
                setting.SaveSetting();
            };
        }
Example #30
0
        public PagePlayers()
        {
            InitializeComponent();
            RecivePlayersList();

            //close panel add player
            PanelAddPlayer.MouseDown += (e, s) =>
            {
                if (s.Source.GetType() == typeof(Grid))
                {
                    ShowOffSubpagePlayer();
                }
            };

            //close panel search
            PanelSearch.MouseDown += (s, e) =>
            {
                if (e.Source.GetType() == typeof(Grid))
                {
                    ShowOffPanelSearch();
                }
            };

            //show panel search
            BTNSearch.MouseDown += (s, e) =>
            {
                ShowOpenPanelSearch();
            };

            //show paneladdplayer
            BTNShowPanelAdd.MouseDown += (s, e) =>
            {
                ShowSubpagePlayer();
            };

            //actin add player
            BTNaddPlayer.MouseDown += (s, e) =>
            {
                SDK.SDK_PageDashboards.DashboardGame.PageStudios.ReciveMonetize(result =>
                {
                    //limit filter
                    if (PlayerCount + 1 <= result["Players"])
                    {
                        SDK.SDK_PageDashboards.DashboardGame.PagePlayers.CreatPlayer(TextBoxUsername.Text, TextBoxPassword.Password,
                                                                                     (resultCreated) =>
                        {
                            RecivePlayersList();

                            ShowOffSubpagePlayer();

                            DashboardGame.Notifaction("Player Added", StatusMessage.Ok);

                            //add log
                            var Detail = new BsonDocument
                            {
                                { "Username", TextBoxUsername.Text },
                                { "Password", TextBoxPassword.Password },
                                { "LocalTime", DateTime.Now }
                            };

                            SDK.SDK_PageDashboards.DashboardGame.PageLog.AddLog("Add Player", $"You have added  \" {TextBoxUsername.Text} \" player", Detail, false, resultlog => { });
                        }
                                                                                     );
                    }
                    else
                    {
                        DashboardGame.Notifaction("Cannot create new player. Please buy more players than payments", StatusMessage.Error);
                    }
                }, () => { });
            };

            BTNSeeMorePlayer.MouseDown += (s, e) =>
            {
                ReciveCount           += 100;
                TextSeeMoreNumber.Text = ReciveCount.ToString();
                RecivePlayersList();
            };
        }