Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            GestAuthentification gesAu = new GestAuthentification();

            try
            {
                gesAu.Load("users.txt");
                gesAu.AddUser(textBox1.Text, textBox2.Text);
                gesAu.Save("users.txt");
            }
            catch (WrongPassword err) { MessageBox.Show(err.EnvoyerMessage()); }
            catch (UserUnknown err) { MessageBox.Show(err.EnvoyerMessage()); }

            Form chatroom = new ChatroomForm(textBox1.Text);

            chatroom.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("Please entre your name!");
                textBox1.Focus();
                return;
            }

            IAuthentificationManager am = new GestAuthentification();

            am.Load("users.txt");

            try
            {
                am.Authentify(textBox1.Text, textBox2.Text);
                Form chatroomForm = new ChatroomForm(textBox1.Text);

                chatroomForm.Show();
                this.Hide();
            }
            catch (WrongPassword err) { MessageBox.Show(err.EnvoyerMessage()); }
            catch (UserUnknown err) { MessageBox.Show(err.EnvoyerMessage()); }
        }