コード例 #1
0
        public void loggingIn()
        {
            string           username = this.UsernameBox.Text;
            string           password = this.PasswordBox.Text;
            FileAccessModule FAM      = new FileAccessModule();

            if (!FAM.checkUser(username, password))
            {
                this.LogInWarning.Text    = "Invalid Login Credentials";
                this.LogInWarning.Visible = true;
                wait(1500);
                this.LogInWarning.Visible = false;
            }
            else
            {
                //Check user came positive
                //we can search it now
                this.LogInWarning.Text    = "Successful Login. Please Wait.";
                this.LogInWarning.Visible = true;
                wait(2000);
                this.LogInWarning.Visible = false;
                Console.WriteLine();
                loggedIn = FAM.readUserFile(username, password);

                StoreSystems LoggedIn = new StoreSystems();

                LoggedIn.loggedUser = loggedIn;

                Welcomepage = new WelcomePage(LoggedIn);
                Welcomepage.StartPosition = FormStartPosition.Manual;
                Welcomepage.Left          = this.Location.X;
                Welcomepage.Top           = this.Location.Y;
                Welcomepage.Location      = this.Location;
                Welcomepage.SetDesktopLocation(this.Location.X, this.Location.Y);

                Welcomepage.setLoggedIn();

                Welcomepage.MainForm = this;

                Welcomepage.Show();

                //Time to purge loggin
                this.UsernameBox.Text = "";
                this.PasswordBox.Text = "";
                loggedIn = null;
                this.Hide();
            }
        }