Пример #1
0
        private void editLoginBtn_Click(object sender, EventArgs e)
        {
            if (_currentLoginSession == null)
            {
                MessageBox.Show(this, "Du måste först logga in!");
            }
            CreateLoginForm createLoginForm = new CreateLoginForm(_currentLoginSession);

            while (true)
            {
                DialogResult loginResult = createLoginForm.ShowDialog(this);
                if (loginResult == DialogResult.OK)
                {
                    NetworkClient client = new NetworkClient(_settings);
                    if (!client.UpdateLogin(createLoginForm.getLoginAccount(), _currentLoginSession.Password, _currentLoginSession.Playername))
                    {
                        MessageBox.Show(this, "Uppdatering av inloggning misslyckades, gamla värdet stämmer inte!");
                    }
                }
                else
                {
                    break;
                }
            }
        }
Пример #2
0
        private void createLoginBtn_Click(object sender, EventArgs e)
        {
            CreateLoginForm createLoginForm = new CreateLoginForm();
            LoginAccount    loginAccount    = null;

            while (true)
            {
                DialogResult loginResult = createLoginForm.ShowDialog(this);
                if (loginResult == DialogResult.OK)
                {
                    NetworkClient client = new NetworkClient(_settings);
                    loginAccount = createLoginForm.getLoginAccount();
                    if (!client.CreateLogin(loginAccount))
                    {
                        MessageBox.Show(this, "Skapande av inloggning misslyckades, användarnamnet finns redan!");
                    }
                    else
                    {
                        login(loginAccount.Username, loginAccount.Password);
                        break;
                    }
                }
                else
                {
                    break;
                }
            }
        }