protected override async void OnNavigatedTo(NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("OnNavigatedTo Enter Calibration Page"); sdkLib = rootPage.GetEBeam(); if (sdkLib != null) { sdkLib.setCalirationMode(true); sdkLib.firePenDataEvent += OnPenDataHandlerAsync; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { System.Diagnostics.Debug.WriteLine("OnNavigatedTo Enter Calibration Page"); sdkLib = rootPage.GetEBeam(); if (sdkLib != null) { sdkLib.setCalirationMode(true); if (sdkLib.getStationPosition() == eBeamSDKLib.DIRECTION_LEFT) { LeftSide.IsChecked = true; } else { RightSide.IsChecked = true; } sdkLib.firePenDataEvent += OnPenDataHandlerAsync; } }
public async void OnPenConnectionHandlerAsync(object sender, PenConnectionEvent e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { switch (e.status) { case eBeamSDKLib.PEN_BLE_CONN: StopButton.Content = "Stop"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "BLE CONNECTED"; break; case eBeamSDKLib.PEN_DATA_READY: StopButton.Content = "Stop"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "DATA READY"; int w = sdkLib.getCalibrationWidth(); int h = sdkLib.getCalibrationHeight(); drawCanvas.Width = DRAW_CANVAS_HEIGHT * ((float)w / (float)h); drawCanvas.Height = DRAW_CANVAS_HEIGHT; break; case eBeamSDKLib.PEN_DISCONNECT: StopButton.Content = "Stop"; ConnectButton.Content = "Connect"; ConnectionStatus.Text = "DISCONNECTED"; sdkLib = null; break; case eBeamSDKLib.PEN_DATA_STOP: StopButton.Content = "Resume"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "STOPPED"; break; } }); }
private void ConnectButton_Click() { if (sdkLib == null) { sdkLib = new eBeamSDKLib(); rootPage.SetEBeamSDK(ref sdkLib); sdkLib.connectDeviceAsync(rootPage.SelectedBleDeviceId); #if true PenDataEventHandler handler = new PenDataEventHandler(OnPenDataHandlerAsync); sdkLib.firePenDataEvent += handler; PenConditonEventHandler handler2 = new PenConditonEventHandler(OnPenConditionHandlerAsync); sdkLib.firePenConditionDataEvent += handler2; PenConnectionEventHandler handler3 = new PenConnectionEventHandler(OnPenConnectionHandlerAsync); sdkLib.firePenConnectionEvent += handler3; PenButtonEventHandler handler4 = new PenButtonEventHandler(OnPenButtonHandlerAsync); sdkLib.firePenButtonEvent += handler4; #endif } else { sdkLib.DisConnectAsync(); } }
public async void OnPenConnectionHandlerAsync(object sender, PenConnectionEvent e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { switch (e.status) { case eBeamSDKLib.PEN_BLE_CONN: StopButton.Content = "Stop"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "BLE CONNECTED"; break; case eBeamSDKLib.PEN_DATA_READY: SetDeviceInfoToUI(); StopButton.Content = "Stop"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "DATA READY"; break; case eBeamSDKLib.PEN_DISCONNECT: StopButton.Content = "Stop"; ConnectButton.Content = "Connect"; ConnectionStatus.Text = "DISCONNECTED"; sdkLib = null; break; case eBeamSDKLib.PEN_DATA_STOP: StopButton.Content = "Resume"; ConnectButton.Content = "DisConnect"; ConnectionStatus.Text = "STOPPED"; break; } }); }
public void SetEBeamSDK(ref eBeamSDKLib sdk) { m_eBeam = sdk; }