Esempio n. 1
0
        private void connectAndLogin_Click(object sender, EventArgs e)
        {
            if (!Chat.Connect())
            {
                MessageBox.Show("Failed to reach the server, try again later!");
                return;
            }

            Chat.SendData($"login\\{usrBox.Text}\\{passBox.Text}");

            string[] data = Chat.Recieve();

            bool isValid = bool.Parse(data[0]);

            if (isValid)
            {
                Chat.username = usrBox.Text;
                Chat.password = passBox.Text;
                Form1 main = new Form1();
                this.Hide();
                main.ShowDialog();
                this.Show();
            }
            else
            {
                MessageBox.Show("An error occured: " + data[1]);
            }
        }
Esempio n. 2
0
        private void registerAcc_Click(object sender, EventArgs e)
        {
            if (!Chat.Connect())
            {
                MessageBox.Show("Failed to reach the server, try again later!");
                return;
            }

            Chat.SendData($"reg\\{usrBox.Text}\\{passBox.Text}");

            Chat.username = usrBox.Text;
            Chat.password = passBox.Text;

            this.Close();
        }