void ButtonComWithSensor(Object sender, Windows.UI.Xaml.RoutedEventArgs e) { AppBarButton buttton = sender as AppBarButton; if (buttton != null) { if (buttton.Name == "InitSensor") { SensorCMDs.InitSensor(m_Sensorinputconfigoptions); m_Environment.SensorInitialized = false; SensorIDValue.Text = ""; } else if (buttton.Name == "RegisterFingerId") { if (DataSets.SelectedItem != null) { DBDataSet dataSet = DataSets.SelectedItem as DBDataSet; if (dataSet != null) { SensorCMDs.RegisterFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID); DataSets.SelectedItem = null; } } } else if (buttton.Name == "VerifyFingerId") { SensorCMDs.VerifyFingerId(m_Sensorinputconfigoptions); DataSets.SelectedItem = null; } else if (buttton.Name == "DeleteallFingerIs") { SensorCMDs.DeleteFingerId(m_Sensorinputconfigoptions, (UInt16)10000); } else if (buttton.Name == "DownloadFingerId") { if (DataSets.SelectedItem != null) { DBDataSet dataSet = DataSets.SelectedItem as DBDataSet; if (dataSet != null) { SensorCMDs.DownloadFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID, dataSet.FingerTemplate); } DataSets.SelectedItem = null; } } else if (buttton.Name == "DownloadallFingerIds") { SensorCMDs.DeleteFingerId(m_Sensorinputconfigoptions, 10000); // delete complete FingerLib into Sensor for (int i = 0; i < this.m_DataSets.Count; i++) { DBDataSet dataSet = m_DataSets[i]; SensorCMDs.DownloadFingerId(m_Sensorinputconfigoptions, (UInt16)dataSet.FingerID, dataSet.FingerTemplate); } DataSets.SelectedItem = null; } else if (buttton.Name == "SetSensorID") { byte[] SensorId = Encoding.ASCII.GetBytes(SensorIDValue.Text); SensorCMDs.SetSensorID(m_Sensorinputconfigoptions, SensorId); // Set Sensor ID SensorIDValue.Text = ""; DataSets.SelectedItem = null; } SensorCmdState.Text = "..."; } }
async private void GPIOConnector_ChangeGPIOs(object sender, IPropertySet propertys) { await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => { // your code should be here m_GPIOEnvironmentConnectors.ProcessPropertysFromGPIOConnector(propertys); var con = m_GPIOEnvironmentConnectors.getGPIOOConnectorByOutputPropertySet(propertys); if (con == null) { return; } if (m_ProcessGPIOEvents == null) { return; } for (int i = 0; i < m_ProcessGPIOEvents.Count; i++) { ProcessGPIOEvents item = m_ProcessGPIOEvents[i]; if (item.InputActiv()) { removeOldEvents(); // ältere löschen, welche nach 5 sec. nicht beantwortet waren if ((item.AccessRights > 0) && m_Environment.ConnectorSEN0188Enable) { if (m_Environment.SensorConnecorInitialized) { ProcessGPIOEvents Processitem = new ProcessGPIOEvents(item); m_EventQueue.Enqueue(Processitem); SensorCMDs.VerifyFingerId(m_Environment.SensorInputServiceConnectorConfig); } else { string cmdState = "Fingerprint Connector not initialized!"; int state = -1; FingerEvent eventSet = createSensorEvent("John", "Doe", -1, -1, item.Ident, state, cmdState); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); eventSet.SensorId = enc.GetBytes(m_SensorID); bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet); NotifyEvent?.Invoke(this, eventSet); } } else { item.UpdateState(0); item.ProcessOutput(); item.UpdateState(1); int state = -1; string cmdState = "no FingerSensor used"; FingerEvent eventSet = createSensorEvent("John", "Doe", -1, -1, item.Ident, state, cmdState); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); eventSet.SensorId = enc.GetBytes(m_SensorID); bool insert = m_FingertEventDatabase.InsertFingerEvent(eventSet); NotifyEvent?.Invoke(this, eventSet); } } } }); }