Esempio n. 1
0
        private void OpenSelectDeviceDialog(DeviceIdentity selectedDeviceIdentity)
        {
            //ResetGUI();
            //DisplayMessage("Device configuration");
            //EnableGUI(false);

            try
            {
                //IWin32Window win32Window = new WindowWrapper(this);
                SelectDeviceWindow_new selectDevice = new SelectDeviceWindow_new(selectedDeviceIdentity, this);
                if (_fpScanner != null)
                {
                    selectDevice.FingerPrintScanner = _fpScanner;
                }

                selectDevice.ShowDialog();

                if (selectDevice.rDialogResult)
                //if (selectDevice.rDialogResult.HasValue && selectDevice.DialogResult.Value)
                {
                    // DisplayMessage("Opening device");

                    _fpScanner = selectDevice.FingerPrintScanner;
                    if (_fpScanner != null)
                    {
                        //ResetGUI();
                        //EnableGUI(true);
                    }
                }
                else
                {
                    DisplayError("No device selected");
                    if (selectDevice.FingerPrintScanner != null)
                    {
                        selectDevice.FingerPrintScanner.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayError(ex.Message);
            }
        }
Esempio n. 2
0
        private void OpenSelectDeviceDialog_setup(DeviceIdentity selectedDeviceIdentity)
        {
            bool runNextPhase = true;

            //ResetGUI();
            //DisplayMessage("Device configuration");
            //EnableGUI(false);

            try
            {
                //IWin32Window win32Window = new WindowWrapper(this);
                SelectDeviceWindow_new selectDevice = new SelectDeviceWindow_new(selectedDeviceIdentity, this);
                if (_fpScanner != null)
                {
                    selectDevice.FingerPrintScanner = _fpScanner;
                }

                selectDevice.ShowDialog();

                if (selectDevice.rDialogResult)
                //if (selectDevice.rDialogResult.HasValue && selectDevice.DialogResult.Value)
                {
                    // DisplayMessage("Opening device");

                    _fpScanner = selectDevice.FingerPrintScanner;
                    //ic._fpScanner = _fpScanner;
                    if (_fpScanner != null)
                    {
                        //ResetGUI();
                        //EnableGUI(true);
                    }
                    // runNextPhase = true;

                    // NewUserRegistraion_popup();
                    ////EnterUsernameWindow_new
                    //EnterUsernameWindow_new enterUsernameWindow = new EnterUsernameWindow_new(true);
                    ////enterUsernameWindow.Owner = this;
                    //enterUsernameWindow.ShowDialog();

                    //if ((bool)enterUsernameWindow.DialogResponse.result) //this.Close();

                    //{
                    //    try
                    //    {
                    //        _afis = new LocalAFIS();
                    //        if (!enrollForm_hidden)
                    //        {
                    //            //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis);
                    //            //EnrollmentWindow_new enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis,
                    //            enrollmentWindow = new EnrollmentWindow_new(_fpScanner, _afis,
                    //               loggedin_staff, enterUsernameWindow.DialogResponse.enteredUsername, this);
                    //            //enrollmentWindow.MdiParent = this;
                    //            //enrollmentWindow.StartPosition = FormStartPosition.CenterScreen;
                    //            // EnrollmentWindow enrollmentWindow = new EnrollmentWindow(_fpScanner, _afis);
                    //            //enrollmentWindow.Owner = this;
                    //            //enrollmentWindow.Show();
                    //            var ddg = enrollmentWindow.ShowDialog();
                    //        }
                    //        else
                    //        {
                    //            enrollmentWindow.reloadForm(enterUsernameWindow.DialogResponse.enteredUsername);
                    //            var ddg = enrollmentWindow.ShowDialog();
                    //        }
                    //    }
                    //    catch { }

                    //}
                }
                else
                {
                    //DisplayError("No device selected");


                    //DialogResult msg = MessageBox.Show("Kindly connect your fingerprint Device and Retry", "No device selected"
                    //    , MessageBoxButtons.RetryCancel, MessageBoxIcon.Information);


                    AlertForm1 al = new AlertForm1("Kindly connect your fingerprint Device and Retry",
                                                   AlertForm1.AlertOptions.RETRYCANCEL
                                                   , AlertForm1.AlertType.error, "No device selected");
                    var aa = al.ShowDialog();

                    if (!al.rDialogResult)
                    //if (msg == DialogResult.Cancel)
                    {
                        if (selectDevice.FingerPrintScanner != null)
                        {
                            selectDevice.FingerPrintScanner.Dispose();
                        }
                        runNextPhase = false;
                    }
                    else
                    {
                        OpenSelectDeviceDialog_setup(selectedDeviceIdentity);

                        //connect_Device();
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayError(ex.Message);
            }
        }