Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Signup signupPage = new Signup();

            this.Hide();
            signupPage.Show();
        }
Пример #2
0
        private void labelForgotPassword_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Please register again!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            this.Close();
            Signup mainForm = new Signup();

            mainForm.Visible = true;
        }
Пример #3
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            string username            = textBoxUsername.Text;
            string password            = textBoxPassword.Text;
            string dataMemberDirectory = @"\Data\" + username;
            string winDir       = Path.GetDirectoryName(Application.ExecutablePath);
            string path         = winDir + dataMemberDirectory;
            string dataFilePath = path + @"\data.txt";

            if (username != "" && password != "")
            {
                if (Directory.Exists(path))
                {
                    StreamReader srForPassword = new StreamReader(dataFilePath);
                    srForPassword.ReadLine();
                    srForPassword.ReadLine();
                    string passwordSaved = srForPassword.ReadLine();
                    if (passwordSaved == password)
                    {
                        CodeEditor cd = new CodeEditor(username);
                        cd.Show();
                        this.Visible = false;
                    }
                    else
                    {
                        MessageBox.Show("Wrong Password", "Login", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    //string passwordSaved = File.ReadLines(dataFilePath).ToString();
                    // MessageBox.Show(passwordSaved);
                }
                else
                {
                    DialogResult result = MessageBox.Show("Wrong Username \nClick OK if you want to sign up.", "Login", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (result == DialogResult.OK)
                    {
                        this.Close();
                        Signup mainForm = new Signup();
                        mainForm.Visible = true;
                    }
                }
            }
        }