Exemple #1
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            Main_Simulator_ main = new Main_Simulator_();

            main.Show();
            this.Hide();
        }
Exemple #2
0
        private void btnEnter_Click(object sender, EventArgs e)
        {
            List <Users> uc  = new List <Users>();
            Users        usc = new Users();

            uc = usc.GetUsers();

            string username = txtUsername.Text;
            string password = txtPassword.Text;


            bool ValidChecker = false;

            try
            {
                foreach (Users item in uc)
                {
                    if (username == item.UserName && password == item.Password)
                    {
                        ValidChecker = true;
                    }
                }

                if (ValidChecker)
                {
                    Main_Simulator_ open = new Main_Simulator_();
                    open.Show();
                    this.Hide();
                }
                else
                {
                    throw new CustomExeption("Invalid Credentials");
                }
            }


            catch (CustomExeption custom)
            {
                MessageBox.Show(custom.Message);
            }
        }