コード例 #1
0
        /// <summary>
        /// Method to unlock the screen. At present this method only
        /// checks for null user input. Once we get the headset and the
        /// MATLAB part is completed, we can call the MATLAB function
        /// from this method.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UnlockButton_Click(object sender, EventArgs e)
        {
            userName = this.userNameTextbox.Text;
            string userNameFile = userName;

            userNameString = userName;


            if (this.userNameTextbox.TextLength == 0)
            {
                MessageBox.Show("No username entered!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                LoginForm loginFormObj = new LoginForm();
                BackgroundScreen.loginFormReload(loginFormObj);
                return;
            }

            try
            {
                try
                {
                    DirectoryInfo   dInfo  = new DirectoryInfo(Environment.CurrentDirectory);
                    DirectoryInfo[] dInfos = dInfo.GetDirectories();

                    foreach (DirectoryInfo dInfo1 in dInfos)
                    {
                        if (userNameFile.Equals(dInfo1.Name))
                        {
                            flag = true;
                            // screenLockObj.removeFromStartup();
                            this.Close();
                            // screenLockHelperObj.maximizeWindow();
                            // screenLockHelperObj.releaseHook();

                            // this.Hide();

                            //if (WindowsGameSimpleCube1.AuthenticateForm.authenticationFormStaticObject != null)
                            //{
                            //    WindowsGameSimpleCube1.AuthenticateForm.authenticationFormStaticObject.Show();
                            //}
                            //else
                            //{
                            //WindowsGameSimpleCube1.AuthenticateForm.authenticationFormStaticObject = new WindowsGameSimpleCube1.AuthenticateForm();
                            //WindowsGameSimpleCube1.AuthenticateForm.authenticationFormStaticObject.Show();
                            //}

                            SignalTrainAndMatch.MatchForm matchFormObj = new SignalTrainAndMatch.MatchForm();
                            matchFormObj.Show();
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace);
                    MessageBox.Show("Exception Username: "******" is invalid! ", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Close();
                    LoginForm loginFormObj = new LoginForm();
                    BackgroundScreen.loginFormReload(loginFormObj);
                    flag = true;
                }


                if (!flag)
                {
                    MessageBox.Show("Username: "******" is invalid! ", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Close();
                    LoginForm loginFormObj = new LoginForm();
                    BackgroundScreen.loginFormReload(loginFormObj);
                }
            }
            catch (Exception ee) {
            }
        }
コード例 #2
0
 /// <summary>
 /// Constructor of the username prompt.
 /// Associate an event handler if the form loses its focus.
 /// Also create a new object of backGroundScreen class
 /// and display.
 /// </summary>
 public LoginForm()
 {
     InitializeComponent();
     loginFormStaticObject = this;
 }