コード例 #1
0
        //Logout Button
        private void LockBtn_Click(object sender, EventArgs e)
        {//Hiding all Ui elements
            UserLabel.Hide();
            UserBtn.Hide();
            DetectBtn.Hide();
            TrainBtn.Hide();
            LockBtn.Hide();
            ExitBtn.Hide();
            mark2.Hide();

            LoginPanel.Show();
            LoginPanel.Dock = DockStyle.Fill;
            LoginPanel.BringToFront();

            NameBox.Text = "";
            PassBox.Text = "";
        }
コード例 #2
0
        //Submit Button
        private async void SigninBtn_Click(object sender, EventArgs e)
        {
            //Check if Id and password are not empty
            if (NameBox.Text != "" && PassBox.Text != "")
            {
                //If Login Case
                if (SigninBtn.ButtonText == "Login")
                {
                    //DOLOGIN : by Sending user and pw to reader Class of data base
                    SignInResult resutl = LoginSys.SignIn(NameBox.Text, PassBox.Text);
                    if (resutl.LoggedIn)
                    {
                        //If Login Operation Successfull , Show the Ui
                        LoginPanel.Dock = DockStyle.None;
                        LoginPanel.Hide();
                        LoginPanel.SendToBack();

                        UserLabel.Show();
                        UserBtn.Show();
                        DetectBtn.Show();
                        TrainBtn.Show();
                        LockBtn.Show();
                        ExitBtn.Show();
                        mark2.Show();

                        UserLabel.Text = resutl.UserData.Name.ToUpperInvariant();
                        DetectionPanel.Show();
                    }
                    else
                    {
                        label3.Text = resutl.Reason;
                    }
                }
                else
                {
                    //If Registration Senario : Sending User and pw to Writer Class
                    bool suResult = await LoginSys.SignUp(NameBox.Text, PassBox.Text, "", 0);

                    if (suResult)
                    {
                        label3.Text = "Registration Done Sucessfully";
                    }
                }
            }
        }
コード例 #3
0
ファイル: MainView.cs プロジェクト: rataweb/TapecartFlasher
        private void DetectBtn_Click(object sender, EventArgs e)
        {
            DetectBtn.Enabled = false;
            DetectBtn.Text    = "Detecting...";
            DetectBtn.Refresh();

            _logging.Info(MODUL_NAME, "DetectBtn_Click", "Detecting...");

            InitComportSelection();

            ComPortCb.SelectedItem = null;
#warning TODO check why detection always works only on the second pass
            // repeat 2 times
            for (int i = 0; i < 2; i++)
            {
                foreach (ComPortSelectionItem port in _comPorts)
                {
                    Debug.WriteLine(port);
                    if (_arduinoComm.CheckPort(port))
                    {
                        ComPortCb.SelectedItem = port;
                        break;
                    }
                }
                if (ComPortCb.SelectedItem != null)
                {
                    break;
                }
            }

            if (ComPortCb.SelectedItem == null)
            {
                _logging.Info(MODUL_NAME, "DetectBtn_Click", "No COM port detected");
            }
            else
            {
                _logging.Info(MODUL_NAME, "DetectBtn_Click", $"{((ComPortSelectionItem)ComPortCb.SelectedItem).ComPort} detected");
            }

            DetectBtn.Enabled = true;
            DetectBtn.Text    = "Detect";
        }