예제 #1
0
        private void Notif_Click(object sender, EventArgs e)
        {
            String selection = this.ModeSelection.Text;

            if (selection.Equals("Edit Game"))
            {
                String searchbox = this.TextBox6.Text;
                if (Int32.TryParse(searchbox, out int searchresult))
                {
                    List <Game> GameLibrary = FAM.GetGameLibrary();
                    var         FindGame    = GameLibrary.Find(a => a.GameID.Equals(searchresult.ToString()));

                    FocusedGame = FindGame;         //establish game in memory
                    setGameInfo(FocusedGame);

                    this.TextBox1.ReadOnly = false;
                    this.TextBox2.ReadOnly = false;
                    this.TextBox4.ReadOnly = false;
                    this.TextBox5.ReadOnly = false;
                    this.TextBox6.ReadOnly = false;
                }
            }
            else if (selection.Equals("Remove Game"))
            {
                String searchbox = this.TextBox6.Text;
                if (Int32.TryParse(searchbox, out int searchresult))
                {
                    List <Game> GameLibrary = FAM.GetGameLibrary();
                    var         FindGame    = GameLibrary.Find(a => a.GameID.Equals(searchresult.ToString()));
                    FocusedGame = FindGame;
                    setGameInfo(FocusedGame);

                    this.TextBox1.ReadOnly = true;
                    this.TextBox2.ReadOnly = true;
                    this.TextBox4.ReadOnly = true;
                    this.TextBox5.ReadOnly = true;
                    this.TextBox6.ReadOnly = false;
                }
            }
            else if (selection.Equals("Edit User"))
            {
                String searchbox = this.TextBox6.Text;
                if (FAM.checkUsernameExist(searchbox))
                {
                    FocusedUser = FAM.ADMINreadUserFile(searchbox);
                    setUserInfo(FocusedUser);
                    this.TextBox1.ReadOnly = false;
                    this.TextBox2.ReadOnly = false;
                    this.TextBox4.ReadOnly = false;
                    this.TextBox5.ReadOnly = false;
                    this.TextBox6.ReadOnly = false;
                }
            }
            else if (selection.Equals("Remove User"))
            {
                String searchbox = this.TextBox6.Text;
                if (FAM.checkUsernameExist(searchbox))
                {
                    FocusedUser = FAM.ADMINreadUserFile(searchbox);
                    setUserInfo(FocusedUser);
                }
            }
        }