Exemple #1
0
        private bool loginWin()
        {
            Login login = new Login();
            login.ShowDialog();

            if (login.state == 0)
            {
                this.Close();
                return true;
            }

            try
            {
                client = new Client();
                client.connect();
                if (login.state == 2)
                {
                    if (!(client.register(login.username, login.pass)))
                    {
                        MessageBox.Show(strings.alreadyRegistered);
                        return false;
                    }

                }
            }
            catch (Exception)
            {
                MessageBox.Show(strings.serverTimeout);
                return false;
            }

            client.login(login.username, login.pass);

            if (client.loggedIn)
                this.connect = true;
            else
            {
                MessageBox.Show(strings.incorrect);
                return false;
            }

            return true;
        }