예제 #1
0
        private void btnDisconnectRs232_Click(object sender, EventArgs e)
        {
            MessageBox.Show("lector conectado");
            //处理串口断开连接读写器
            reader.CloseCom();

            //处理界面元素是否有效
            SetFormEnable(false);
            btnConnectRs232.Enabled    = true;
            btnDisconnectRs232.Enabled = false;

            //设置按钮字体颜色
            btnConnectRs232.ForeColor    = Color.Indigo;
            btnDisconnectRs232.ForeColor = Color.Black;
        }
        private void CallMainMenu()
        {
            try
            {
                //this.Hide();
                //reader.CloseCom();
                //MainMenu MenuForm = new MainMenu(tokenvalue, portname);
                //MenuForm.Show();

                //Back to Main Menu
                if (IsCameraConnected)
                {
                    cam.Stop();
                }

                this.Hide();
                reader.CloseCom();
                MainMenu MenuForm = new MainMenu(tokenvalue, roleValue);
                MenuForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ValidateRule()
        {
            if (roleValue == "ROLE_ADMIN")
            {
                CallMainMenu();
            }
            else if (roleValue == "ROLE_GUARD")
            {
                //Environment.Exit(0);
                IsCallingMainMenu = true;

                this.Hide();
                reader.CloseCom();
                LoginActivity LoginForm = new LoginActivity();
                LoginForm.Show();
            }
        }