private void RegisterButton_Click(object sender, EventArgs e)
        {
            //Open Register window
            RegisterWindow r1 = new RegisterWindow();

            r1.ShowDialog();
        }
Exemple #2
0
        private async void RegForm()
        {
            RegisterWindow reg_form;

            reg_form = new RegisterWindow();
            if (reg_form.ShowDialog() ?? false)
            {
                //Get new data
                User userToAdd = reg_form.NewUser;

                //Check if the username is allowed.
                if (userToAdd.username.Contains('*') ||
                    userToAdd.username.Contains('-') ||
                    userToAdd.username.Equals(Data.PUBLIC_ID) ||
                    userToAdd.username.Equals(Data.SERVER_NAME))
                {
                    new Thread(() =>
                    {
                        MessageBox.Show("Új felhasználó létrehozása sikertelen. Ok: Érvénytelen felhasználónév.", "Server User Create");
                    }).Start();
                }
                else if (_users.Where(user => user.username.Equals(userToAdd.username)).Count() > 0)
                {
                    new Thread(() =>
                    {
                        MessageBox.Show("Új felhasználó létrehozása sikertelen. Ok: Létező felhasználónév.", "Server User Create");
                    }).Start();
                }
                //Update with the authorized new user's data.
                else
                {
                    _users.Add(userToAdd);
                    await AsyncSaveData();
                }
            }
        }