Example #1
0
        public FormStart()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.Manual;
            this.Left          = Top = 0;
            this.Width         = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height        = Screen.PrimaryScreen.WorkingArea.Height;

            this.KeyPreview = true;

            _formOptions        = new FormOptions(this);
            _formUserManagement = new FormUserManagement(this, _formOptions);

            // Query database and set state
            // Check to see if there's at least one user in the database
            if (User.GetAll().Count == 0)
            {
                _globalState = State.Uninitialized;
            }
            else
            {
                _globalState = State.Idle;
            }

            // Initialize Servo Code
            if (IS_LINUX)
            {
                Pi.Init <BootstrapWiringPi>();
                servo         = (GpioPin)Pi.Gpio[13];
                servo.PinMode = GpioPinDriveMode.Output;
                servo.StartSoftPwm(0, 100);
                // Assume lock is open and close it
                lock_open = true;
                close_lock();
            }

            // Update visibility of form components
            UpdateComponents();

            foreach (Control control in Controls)
            {
                control.MouseClick += OnAnyMouseClick;
            }

            // Close keypad upon selection of most components
            foreach (Control control in Controls)
            {
                if (control != tbxPin && control != tbxUserPhone && control != btnClearTextBox &&
                    control != tbxUserName && control != tbxSecFactorPinOrCard)
                {
                    control.MouseClick += keyboardClose_Leave;
                }
            }
            this.MouseClick += keyboardClose_Leave;

            // Initialize timer that refreshes the bluetooth device lists every 5 seconds
            base.InitializeBTRefreshBTDeviceListsTimer();
        }
Example #2
0
        public FormUserManagement(FormStart formStart, FormOptions formOptions)
        {
            InitializeComponent();

            _formStart   = formStart;
            _formOptions = formOptions;

            this.StartPosition = FormStartPosition.Manual;
            this.Left          = Top = 0;
            this.Width         = Screen.PrimaryScreen.WorkingArea.Width;
            this.Height        = Screen.PrimaryScreen.WorkingArea.Height;
            this.KeyPreview    = true;

            // Close keypad upon selection of most components
            foreach (Control control in Controls)
            {
                if (control != tbxPin && control != tbxUserPhone && control != btnClearTextBox &&
                    control != tbxUserName)
                {
                    control.MouseClick += keyboardClose_Leave;
                }
            }
            this.MouseClick += keyboardClose_Leave;
        }