void OnGetPinStateCompleteHandler(IMbnPinManager mbnPinManager, MBN_PIN_INFO pinInfo, uint requestId, int status) { if (RaiseOnGetPinStateCompleteEvent != null) { string message = ""; message += "OnGetPinStateComplete event received. Request ID: " + requestId.ToString() + " status: 0x" + status.ToString("X"); message += "\n\nPinType::: " + pinInfo.pinType.ToString(); message += "\nPinState::: " + pinInfo.pinState.ToString(); message += "\nPinAttempts::: " + pinInfo.attemptsRemaining.ToString(); MbnPinInfo mbnPinInfo; mbnPinInfo.msg = message; if (pinInfo.pinState == MBN_PIN_STATE.MBN_PIN_STATE_ENTER) { mbnPinInfo.isPinEnabled = true; } else { mbnPinInfo.isPinEnabled = false; } // Raise event RaiseOnGetPinStateCompleteEvent(this, mbnPinInfo); } }
// This will be called to get pin state public void GetPinState() { uint requestId = 0; IMbnPinManager pinManager = m_MbnInterface as IMbnPinManager; pinManager.GetPinState(out requestId); m_jsCallback("Waiting for GetPinState to complete for requestId: " + requestId.ToString()); }
public void OnGetPinStateComplete(IMbnPinManager mbnPinManager, MBN_PIN_INFO pinInfo, uint requestId, int status) { OnGetPinStateCompleteHandler callback; if (m_Callback.TryGetTarget(out callback)) { callback.Invoke(mbnPinManager, pinInfo, requestId, status); } }
// This will be called to enter pin public void EnterPin(string pinText) { uint requestId = 0; IMbnPinManager pinManager = m_MbnInterface as IMbnPinManager; IMbnPin pin = pinManager.GetPin(MBN_PIN_TYPE.MBN_PIN_TYPE_PIN1); pin.Enter(pinText, out requestId); // Display the message m_jsCallback("Waiting for EnterPin to complete for requestId: " + requestId.ToString()); }
public void GetPinStateButton_Click() { try { uint requestId = 0; // Get pin manager object IMbnPinManager pinManager = m_MbnInterface as IMbnPinManager; // Get pin state pinManager.GetPinState(out requestId); rootPage.NotifyUser("Waiting for GetPinState to complete for requestId: " + requestId.ToString(), NotifyType.StatusMessage); } catch (Exception e) { rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage); } }
public void EnterPinButton_Click(string pinText) { try { uint requestId = 0; // Get pin manager object IMbnPinManager pinManager = m_MbnInterface as IMbnPinManager; // Get pin object for pin type as Pin1 IMbnPin pin = pinManager.GetPin(MBN_PIN_TYPE.MBN_PIN_TYPE_PIN1); // Enter required pin to unlock device pin.Enter(pinText, out requestId); rootPage.NotifyUser("Waiting for EnterPin to complete for requestId: " + requestId.ToString() + "for pin: " + pinText, NotifyType.StatusMessage); } catch (Exception e) { rootPage.NotifyUser(ParseExceptionCode(e), NotifyType.ErrorMessage); } }
async void ProcessOnGetPinStateCompleteHandlerEvt(IMbnPinManager mbnPinManager, MBN_PIN_INFO pinInfo, uint requestId, int status) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { string message = ""; message += "\nOnGetPinStateComplete event received. Request ID: " + requestId.ToString() + " status: 0x" + status.ToString("X"); message += "\n\nPinType::: " + pinInfo.pinType.ToString(); message += "\nPinState::: " + pinInfo.pinState.ToString(); message += "\nPinAttempts::: " + pinInfo.attemptsRemaining.ToString(); if (pinInfo.pinState == MBN_PIN_STATE.MBN_PIN_STATE_ENTER) { message += "\n\nDevice is locked and hence required PIN to unlock. Enter required PIN."; // Enable "Enter" button EnableEnterButton(this, EventArgs.Empty); } rootPage.NotifyUser(message, NotifyType.StatusMessage); }); }
async void ProcessOnGetPinStateCompleteHandlerEvt(IMbnPinManager mbnPinManager, MBN_PIN_INFO pinInfo, uint requestId, int status) { // Dispatch to UI thread await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { string message = ""; message += "\nOnGetPinStateComplete event received. Request ID: " + requestId.ToString() + " status: 0x" + status.ToString("X"); message += "\n\nPinType::: " + pinInfo.pinType.ToString(); message += "\nPinState::: " + pinInfo.pinState.ToString(); message += "\nPinAttempts::: " + pinInfo.attemptsRemaining.ToString(); if (pinInfo.pinState == MBN_PIN_STATE.MBN_PIN_STATE_ENTER) { message += "\n\nDevice is locked and hence required PIN to unlock. Enter required PIN."; // Enable "Enter" button EnableEnterButton(this, EventArgs.Empty); } rootPage.NotifyUser(message, NotifyType.StatusMessage); }); }
// Not implemented for sample public void OnPinListAvailable(IMbnPinManager mbnPinManager) { }
// This will be called back when get pin state operation is complete public void OnGetPinStateComplete(IMbnPinManager mbnPinManager, MBN_PIN_INFO pinInfo, uint requestId, int status) { // Invoke main page thread to show UI OnGetPinStateCompleteHandler callback; if (m_Callback.TryGetTarget(out callback)) { callback.Invoke(mbnPinManager, pinInfo, requestId, status); } }