//private void GetCardInfoSucceeded(string cardUID) //{ // if (_isSmartCardToLogin) // { // // get local user info // DAL_User dAL_User = new DAL_User(); // var user = dAL_User.GetUserBySmartCardId(cardUID); // if (user != null) // { // if (user.Role == EnumUserRoles.DutyOfficer) // { // Session session = Session.Instance; // session.IsSmartCardAuthenticated = true; // Session.Instance[CommonConstants.USER_LOGIN] = user; // this.LayerWeb.RunScript("$('.status-text').css('color','#000').text('Your smart card is authenticated.');"); // // Stop SCardMonitor // SmartCardReaderUtil.Instance.StopSmartCardMonitor(); // // raise succeeded event // SmartCard_OnSmartCardSucceeded(); // } // else // { // SmartCard_OnSmartCardFailed("You do not have permission to access this page"); // } // } // else // { // // raise failed event // SmartCard_OnSmartCardFailed("Unable to read your smart card"); // } // } //} private void Fingerprint_OnFingerprintSucceeded() { _fingerprintFailed = 0; // // Login successfully // // Create a session object to store UserLogin information Session session = Session.Instance; session.IsFingerprintAuthenticated = true; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (user.Role == EnumUserRoles.DutyOfficer) { LayerWeb.RunScript("$('.status-text').css('color','#000').text('Fingerprint authentication is successful.');"); //APIUtils.SignalR.GetLatestNotifications(); Trinity.SignalR.Client.Instance.UserLoggedIn(((Trinity.BE.User)Session.Instance[CommonConstants.USER_LOGIN]).UserId); Thread.Sleep(400); NavigateTo(NavigatorEnums.Queue); } else { MessageBox.Show("You do not have permission to access this page."); //Logout(); session.IsSmartCardAuthenticated = false; session.IsFingerprintAuthenticated = false; session[CommonConstants.USER_LOGIN] = null; session[CommonConstants.PROFILE_DATA] = null; NavigateTo(NavigatorEnums.Authentication_SmartCard); } }
private void Fingerprint_OnFingerprintSucceeded() { // // Login successfully // // Create a session object to store UserLogin information _fingerprintFailed = 0; Session session = Session.Instance; session.IsFingerprintAuthenticated = true; LayerWeb.RunScript("$('[status-authentication]').text('');"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Fingerprint authentication is successful.');"); Thread.Sleep(1000); // if role = 0 (duty officer), redirect to NRIC.html // else (supervisee), redirect to Supervisee.html Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (user.Role == EnumUserRoles.DutyOfficer) { // navigate to Authentication_NRIC NavigateTo(NavigatorEnums.Authentication_NRIC); } else { // navigate to Supervisee page Trinity.SignalR.Client.Instance.UserLoggedIn(user.UserId); NavigateTo(NavigatorEnums.Supervisee); } }
private void SmartCard_OnSmartCardFailed(string message) { // increase counter _smartCardFailed++; // exceeded max failed if (_smartCardFailed > 3) { // Send Notification to duty officer //APIUtils.SignalR.SendNotificationToDutyOfficer(message, message); // show message box to user //MessageBox.Show(message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error); CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", message); // reset counter _smartCardFailed = 0; // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); return; } // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader. Failed: " + _smartCardFailed + "');"); }
private void SmartCard_OnSmartCardFailed(string errMsg, string notification) { // increase counter _smartCardFailed++; // exceeded max failed LayerWeb.ShowMessage("Authentication Failed", errMsg); if (_smartCardFailed > 3) { // Send Notification to duty officer LayerWeb.ShowMessage("Authentication Failed", "Unable to read your smart card.<br/>Please report to the Duty Officer."); Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(null, notification, notification, EnumNotificationTypes.Error); // show message box to user //MessageBox.Show(message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error); //_popupModel.Title = "Authorization Failed"; //_popupModel.Message = message; //_popupModel.IsShowLoading = false; //_popupModel.IsShowOK = true; //LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel)); // reset counter _smartCardFailed = 0; // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); LayerWeb.RunScript("$('[status-authentication]').text('');"); return; } // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); LayerWeb.RunScript("$('[status-authentication]').text('SmartCard Verification Failed : " + _smartCardFailed + "');"); }
private void Fingerprint_OnFingerprintFailed() { // increase counter _fingerprintFailed++; // get USER_LOGIN Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; // exceeded max failed if (_fingerprintFailed > 3) { // set message string errorMessage = "Unable to read " + user.Name + "'s fingerprint."; // Send Notification to duty officer Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(user.UserId, "Fingerprint Authentication failed", errorMessage, EnumNotificationTypes.Error); //NavigateTo(NavigatorEnums.Authentication_SmartCard); //LayerWeb.ShowMessage("Authentication failed", "Fingerprint's Authenication failed!<br /> Please contact your officer."); //for testing purpose // Pause for 1 second and goto Facial Login Screen //Thread.Sleep(1000); _fingerprintFailed = 0; // Navigate to next page: Facial Authentication NavigateTo(NavigatorEnums.Authentication_Facial); return; } // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your finger on the reader');"); LayerWeb.RunScript("$('[status-authentication]').text('FingerPrint Verification Failed : " + _fingerprintFailed + "');"); // restart identification if (user != null) { List <byte[]> fingerprintTemplates = new List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }; FingerprintReaderUtil.Instance.StartIdentification(fingerprintTemplates, Fingerprint_OnIdentificationCompleted); } else { Debug.WriteLine("Fingerprint_OnFingerprintFailed warning: USER_LOGIN is null, can not restart identification."); } }
private void Fingerprint_OnFingerprintFailed() { // Increase failed counter _fingerprintFailed++; Trinity.BE.User user = (Trinity.BE.User)Session.Instance[CommonConstants.USER_LOGIN]; // exceeded max failed if (_fingerprintFailed > 3) { // set message string errorMessage = "Unable to read " + user.Name + "'s fingerprint."; // Send Notification to duty officer Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(user.UserId, "Fingerprint Authentication failed", errorMessage, EnumNotificationTypes.Error); //Trinity.BE.PopupModel popupModel = new Trinity.BE.PopupModel(); //popupModel.Title = "Authorization Failed"; //popupModel.Message = "Unable to read your fingerprint.\nPlease report to the Duty Officer"; //popupModel.IsShowLoading = false; //popupModel.IsShowOK = true; //LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(popupModel)); // Reset failed count _fingerprintFailed = 0; // Navigate to next page: Facial Authentication // Facial SDK has a trouble. Bypass temporarily NavigateTo(NavigatorEnums.Authentication_Facial); //NavigateTo(NavigatorEnums.Authentication_SmartCard); return; } // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your finger on the reader');"); LayerWeb.RunScript("$('[status-authentication]').text('FingerPrint Verification Failed : " + _fingerprintFailed + "');"); // restart identification if (user != null) { List <byte[]> fingerprintTemplates = new List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }; FingerprintReaderUtil.Instance.StartIdentification(fingerprintTemplates, Fingerprint_OnIdentificationCompleted); } else { Debug.WriteLine("Fingerprint_OnFingerprintFailed warning: USER_LOGIN is null, can not restart identification."); } }
private void SmartCard_OnSmartCardSucceeded() { // Set application status is busy ApplicationStatusManager.Instance.IsBusy = true; LayerWeb.RunScript("$('[status-authentication]').text('');"); // Pause for 1 second and goto Fingerprint Login Screen Thread.Sleep(1000); // navigate to next page: Authentication_Fingerprint NavigateTo(NavigatorEnums.Authentication_Fingerprint); // Testing purpose //NavigateTo(NavigatorEnums.Authentication_Facial); }
private void Fingerprint_OnFingerprintFailed() { // increase counter _fingerprintFailed++; // get USER_LOGIN Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; // exceeded max failed if (_fingerprintFailed > 3) { //string message = "Unable to read your fingerprint. Please report to the Duty Officer"; string message = "Unable to read " + user.Name + "'s fingerprint."; // Send Notification to duty officer //APIUtils.SignalR.SendNotificationToDutyOfficer(message, message); // show message box to user //MessageBox.Show(message, "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error); CSCallJS.ShowMessage(LayerWeb, "Authentication Failed", message); // navigate to smartcard login page NavigateTo(NavigatorEnums.Authentication_Facial); // reset counter _fingerprintFailed = 0; return; } // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your finger on the reader. Failed: " + _fingerprintFailed + "');"); // restart identification if (user != null) { List <byte[]> fingerprintTemplates = new List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }; FingerprintReaderUtil.Instance.StartIdentification(fingerprintTemplates, Fingerprint_OnIdentificationCompleted); } else { Debug.WriteLine("Fingerprint_OnFingerprintFailed warning: USER_LOGIN is null, can not restart identification."); } }
private void Main_OnFacialRecognitionSucceeded() { LayerWeb.RunScript("$('.status-text').css('color','#000').text('You have been authenticated.');"); FacialRecognition.Instance.OnFacialRecognitionFailed -= Main_OnFacialRecognitionFailed; FacialRecognition.Instance.OnFacialRecognitionSucceeded -= Main_OnFacialRecognitionSucceeded; FacialRecognition.Instance.OnFacialRecognitionProcessing -= Main_OnFacialRecognitionProcessing; FacialRecognition.Instance.OnCameraInitialized -= Main_OnCameraInitialized; this.Invoke((MethodInvoker)(() => { FacialRecognition.Instance.Dispose(); })); // // Login successfully // // Create a session object to store UserLogin information Session session = Session.Instance; session.IsFacialAuthenticated = true; Thread.Sleep(200); // if role = 0 (duty officer), redirect to NRIC.html // else (supervisee), redirect to Supervisee.html Trinity.BE.User currentUser = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (currentUser.Role == EnumUserRoles.DutyOfficer) { // navigate to Authentication_NRIC NavigateTo(NavigatorEnums.Authentication_NRIC); } else if (currentUser.Role.Equals(EnumUserRoles.USA, StringComparison.InvariantCultureIgnoreCase) || currentUser.Role.Equals(EnumUserRoles.Supervisee, StringComparison.InvariantCultureIgnoreCase)) { // navigate to SuperviseeParticulars page Trinity.SignalR.Client.Instance.UserLoggedIn(currentUser.UserId); NavigateTo(NavigatorEnums.Supervisee_Particulars); } else { _popupModel.Title = "Login Failed"; _popupModel.Message = "You do not have permission to access this page."; _popupModel.IsShowLoading = false; _popupModel.IsShowOK = true; LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel)); } }
private void Fingerprint_OnFingerprintSucceeded() { try { // // Login successfully // // Create a session object to store UserLogin information Session session = Session.Instance; session.IsFingerprintAuthenticated = true; LayerWeb.RunScript("$('[status-authentication]').text('');"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Fingerprint authentication is successful.');"); Thread.Sleep(200); // if role = 0 (duty officer), redirect to NRIC.html // else (supervisee), redirect to Supervisee.html Trinity.BE.User currentUser = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (currentUser.Role == EnumUserRoles.DutyOfficer) { // navigate to Authentication_NRIC NavigateTo(NavigatorEnums.Authentication_NRIC); } else if (currentUser.Role.Equals(EnumUserRoles.USA, StringComparison.InvariantCultureIgnoreCase) || currentUser.Role.Equals(EnumUserRoles.Supervisee, StringComparison.InvariantCultureIgnoreCase)) { // navigate to SuperviseeParticulars page Trinity.SignalR.Client.Instance.UserLoggedIn(currentUser.UserId); NavigateTo(NavigatorEnums.Supervisee_Particulars); } else { _popupModel.Title = "Login Failed"; _popupModel.Message = "You do not have permission to access this page."; _popupModel.IsShowLoading = false; _popupModel.IsShowOK = true; LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel)); } } catch (Exception ex) { MessageBox.Show("Error in Fingerprint_OnFingerprintSucceeded. Details:" + ex.Message); } }
private void Main_OnFacialRecognitionSucceeded() { _fingerprintFailed = 0; LayerWeb.RunScript("$('.status-text').css('color','#000').text('You have been authenticated.');"); FacialRecognition.Instance.OnFacialRecognitionFailed -= Main_OnFacialRecognitionFailed; FacialRecognition.Instance.OnFacialRecognitionSucceeded -= Main_OnFacialRecognitionSucceeded; FacialRecognition.Instance.OnFacialRecognitionProcessing -= Main_OnFacialRecognitionProcessing; FacialRecognition.Instance.OnCameraInitialized -= Main_OnCameraInitialized; this.Invoke((MethodInvoker)(() => { FacialRecognition.Instance.Dispose(); })); // // Login successfully // // Create a session object to store UserLogin information Session session = Session.Instance; session.IsFacialAuthenticated = true; Thread.Sleep(1000); // if role = 0 (duty officer), redirect to NRIC.html // else (supervisee), redirect to Supervisee.html Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (user.Role == EnumUserRoles.DutyOfficer) { // navigate to Authentication_NRIC NavigateTo(NavigatorEnums.Authentication_NRIC); } else { Trinity.SignalR.Client.Instance.UserLoggedIn(user.UserId); // navigate to Supervisee page NavigateTo(NavigatorEnums.Supervisee); } }
private void SmartCard_OnSmartCardFailed(string errMsg, string notification) { // increase counter _smartCardFailed++; LayerWeb.ShowMessage("Authentication Failed", errMsg); // exceeded max failed if (_smartCardFailed > 3) { // Send Notification to duty officer LayerWeb.ShowMessage("Authentication Failed", "Unable to read your smart card.<br/>Please report to the Duty Officer."); Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(null, notification, notification, EnumNotificationTypes.Error); _smartCardFailed = 0; // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); LayerWeb.RunScript("$('[status-authentication]').text('');"); return; } else { // display failed on UI LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); LayerWeb.RunScript("$('[status-authentication]').text('SmartCard Verification Failed : " + _smartCardFailed + "');"); } }
private void NavigateTo(NavigatorEnums navigatorEnum) { // navigate if (navigatorEnum == NavigatorEnums.Login) { LayerWeb.LoadPageHtml("Login.html"); } else if (navigatorEnum == NavigatorEnums.Authentication_SmartCard) { _fingerprintFailed = 0; _smartCardFailed = 0; _isSmartCardToLogin = true; LayerWeb.LoadPageHtml("Authentication/SmartCard.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); SmartCard.Instance.Start(); } else if (navigatorEnum == NavigatorEnums.Authentication_Fingerprint) { try { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; LayerWeb.LoadPageHtml("Authentication/FingerPrint.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your finger on the reader.');"); Fingerprint.Instance.Start(new System.Collections.Generic.List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }); } catch (System.IO.FileNotFoundException ex) { Console.WriteLine("File missing:\n"); Console.WriteLine(ex.FileName); } } else if (navigatorEnum == NavigatorEnums.Authentication_Facial) { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; LayerWeb.LoadPageHtml("Authentication/FacialRecognition.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please remain still as Facial Recognition Check takes place.');"); FacialRecognition.Instance.OnFacialRecognitionFailed += Main_OnFacialRecognitionFailed; FacialRecognition.Instance.OnFacialRecognitionSucceeded += Main_OnFacialRecognitionSucceeded; FacialRecognition.Instance.OnFacialRecognitionProcessing += Main_OnFacialRecognitionProcessing; if (user.User_Photo1 == null || user.User_Photo1.Length == 0) { MessageBox.Show("User photo is null"); return; } this.Invoke((MethodInvoker)(() => { Point startLocation = new Point((Screen.PrimaryScreen.Bounds.Size.Width / 2) - 800 / 2, (Screen.PrimaryScreen.Bounds.Size.Height / 2) - 450 / 2); FacialRecognition.Instance.StartFacialRecognition(startLocation, new System.Collections.Generic.List <byte[]>() { user.User_Photo1, user.User_Photo2 }); })); } else if (navigatorEnum == NavigatorEnums.Queue) { _isSmartCardToLogin = false; LayerWeb.LoadPageHtml("Queue.html"); } // set current page _currentPage = navigatorEnum; // display options in Authentication_SmartCard page if (_currentPage == NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = false; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } // display options in the rest if (!_displayLoginButtonStatus && _currentPage != NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = true; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } }
private void Main_OnFacialRecognitionProcessing() { LayerWeb.RunScript("$('.status-text').css('color','#000').text('Scanning your face...');"); }
public void NavigateTo(NavigatorEnums navigatorEnum) { // navigate if (navigatorEnum == NavigatorEnums.Authentication_SmartCard) { LayerWeb.LoadPageHtml("Authentication/SmartCard.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('" + Resources.INFO_PLACE_SMARTCARD + "');"); SmartCardReaderUtil.Instance.StopSmartCardMonitor(); SmartCard.Instance.Start(); } else if (navigatorEnum == NavigatorEnums.Authentication_Fingerprint) { try { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; LayerWeb.LoadPageHtml("Authentication/FingerPrint.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('" + Resources.INFO_PLACE_THUMBPRINT + "');"); Fingerprint.Instance.Start(new System.Collections.Generic.List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }); } catch (System.IO.FileNotFoundException ex) { Console.WriteLine("File missing:\n"); Console.WriteLine(ex.FileName); } } else if (navigatorEnum == NavigatorEnums.Authentication_Facial) { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if ((user.User_Photo1 == null || user.User_Photo1.Length == 0) && (user.User_Photo2 == null || user.User_Photo2.Length == 0)) { //Trinity.BE.PopupModel popupModel = new Trinity.BE.PopupModel(); //popupModel.Title = "Authorization Failed"; //popupModel.Message = "User '" + user.Name + "' doesn't have any photos"; //popupModel.IsShowLoading = false; //popupModel.IsShowOK = true; //LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(popupModel)); // Navigate to smartcard login page NavigateTo(NavigatorEnums.Authentication_SmartCard); return; } LayerWeb.LoadPageHtml("Authentication/FacialRecognition.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('" + Resources.INFO_REMAIN_YOUR_FACE_STILL + "');"); FacialRecognition.Instance.OnFacialRecognitionFailed += Main_OnFacialRecognitionFailed; FacialRecognition.Instance.OnFacialRecognitionSucceeded += Main_OnFacialRecognitionSucceeded; FacialRecognition.Instance.OnFacialRecognitionProcessing += Main_OnFacialRecognitionProcessing; FacialRecognition.Instance.OnCameraInitialized += Main_OnCameraInitialized; List <byte[]> FaceJpg = new System.Collections.Generic.List <byte[]>() { user.User_Photo1, user.User_Photo2 }; this.Invoke((MethodInvoker)(() => { Point startLocation = new Point((Screen.PrimaryScreen.Bounds.Size.Width / 2) - 800 / 2, (Screen.PrimaryScreen.Bounds.Size.Height / 2) - 450 / 2); FacialRecognition.Instance.StartFacialRecognition(startLocation, FaceJpg); //LayerWeb.RunScript("$('.status-text').css('color','#000').text('Face authentication');"); })); } else if (navigatorEnum == NavigatorEnums.Authentication_NRIC) { _nric.Start(); } else if (navigatorEnum == NavigatorEnums.Supervisee) { // Handle income notifications Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if (user.Role == EnumUserRoles.Supervisee && user.Status == EnumUserStatuses.Blocked) { LayerWeb.ShowMessageAsync(Resources.INFO_YOU_HAVE_BEEN_BLOCKED); _jsCallCS.LogOut(); return; } _signalrClient = Client.Instance; _signalrClient.OnNewNotification += _signalrClient_OnNewNotification; if (this._timerCheckLogout != null) { if (this._timerCheckLogout.Enabled) { this._timerCheckLogout.Stop(); } this._timerCheckLogout.Start(); } _supervisee.Start(); } // set current page _currentPage = navigatorEnum; // display options in Authentication_SmartCard page if (_displayLoginButtonStatus && _currentPage == NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = false; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } // display options in the rest if (!_displayLoginButtonStatus && _currentPage != NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = true; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } }
private void Fingerprint_OnDeviceDisconnected() { LayerWeb.RunScript("alert('The fingerprint does not work');"); }
private void _NavigateToFormThread(object pram) { NavigatorEnums navigatorEnum = (NavigatorEnums)pram; // navigate if (navigatorEnum == NavigatorEnums.Authentication_SmartCard) { LayerWeb.LoadPageHtml("Authentication/SmartCard.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your smart card on the reader.');"); SmartCard.Instance.Start(); } else if (navigatorEnum == NavigatorEnums.Authentication_Fingerprint) { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; LayerWeb.LoadPageHtml("Authentication/FingerPrint.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your thumb print on the reader.');"); //if (user.LeftThumbFingerprint == null && user.RightThumbFingerprint == null) //{ // LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please place your thumb print on the reader.');"); //} //else //{ // string errMsg = user.Name + "'s Fingerprint could not be found."; // LayerWeb.RunScript("$('.status-text').css('color','#000').text('" + errMsg + "');"); //} try { Fingerprint.Instance.Start(new System.Collections.Generic.List <byte[]>() { user.LeftThumbFingerprint, user.RightThumbFingerprint }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (navigatorEnum == NavigatorEnums.Authentication_Facial) { Session session = Session.Instance; Trinity.BE.User user = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; if ((user.User_Photo1 == null || user.User_Photo1.Length == 0) && (user.User_Photo2 == null || user.User_Photo2.Length == 0)) { Trinity.BE.PopupModel popupModel = new Trinity.BE.PopupModel(); popupModel.Title = "Authorization Failed"; popupModel.Message = "User '" + user.Name + "' doesn't have any photos"; popupModel.IsShowLoading = false; popupModel.IsShowOK = true; LayerWeb.InvokeScript("showPopupModal", JsonConvert.SerializeObject(popupModel)); // navigate to smartcard login page NavigateTo(NavigatorEnums.Authentication_SmartCard); return; } LayerWeb.LoadPageHtml("Authentication/FacialRecognition.html"); LayerWeb.RunScript("$('.status-text').css('color','#000').text('Please remain still as Facial Recognition Check takes place.');"); FacialRecognition.Instance.OnFacialRecognitionFailed += Main_OnFacialRecognitionFailed; FacialRecognition.Instance.OnFacialRecognitionSucceeded += Main_OnFacialRecognitionSucceeded; FacialRecognition.Instance.OnFacialRecognitionProcessing += Main_OnFacialRecognitionProcessing; FacialRecognition.Instance.OnCameraInitialized += Main_OnCameraInitialized; this.Invoke((MethodInvoker)(() => { Point startLocation = new Point((Screen.PrimaryScreen.Bounds.Size.Width / 2) - 800 / 2, (Screen.PrimaryScreen.Bounds.Size.Height / 2) - 450 / 2); //Point startLocation = new Point((Screen.PrimaryScreen.Bounds.Size.Width / 2) - 400 / 2, (Screen.PrimaryScreen.Bounds.Size.Height / 2) - 400 / 2); try { FacialRecognition.Instance.StartFacialRecognition(startLocation, new System.Collections.Generic.List <byte[]>() { user.User_Photo1, user.User_Photo2 }); } catch (Exception ex) { MessageBox.Show(ex.Message); } })); } else if (navigatorEnum == NavigatorEnums.Authentication_NRIC) { _nric.Start(); } else if (navigatorEnum == NavigatorEnums.Supervisee_Particulars) { _superviseeParticulars.Start(); //btnConfirm.Enabled = true; } else if (navigatorEnum == NavigatorEnums.Supervisee_NRIC) { _superviseeParticulars.Start(); CSCallJS.DisplayNRICLogin(LayerWeb); } // set current page _currentPage = navigatorEnum; // display options in Authentication_SmartCard page if (_displayLoginButtonStatus && _currentPage == NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = false; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } // display options in the rest if (!_displayLoginButtonStatus && _currentPage != NavigatorEnums.Authentication_SmartCard) { _displayLoginButtonStatus = true; CSCallJS.DisplayLogoutButton(this.LayerWeb, _displayLoginButtonStatus); } }