private void AddBluetoothLE(object sender, RoutedEventArgs e) { BluetoothLEManager bluetoothLEManager = new BluetoothLEManager(); bluetoothLEManager.OnConnect += OnBluetoothLEConnect; bluetoothLEManager.Connect(); }
async Task OnInitialise(bool advertise = true) { if (this.bluetoothLEManager == null) { this.bluetoothLEManager = new BluetoothLEManager(); } if (advertise) { await this.bluetoothLEManager.SetupBluetoothAdvertisement(); } else { await this.bluetoothLEManager.SetupBluetoothWatcher(); } if (this.bluetoothLEManager.isConnected) { if (advertise) { OutputBluetoothConnectionMessage("[Broadcaster] Connection has been established. Enjoy the sharing!"); } else { OutputBluetoothConnectionMessage("[Watcher] Connection has been established. Enjoy the sharing!"); } CurrentState = SharingServiceState.ConnectionEstablished; await this.bluetoothLEManager.ReadAndDispatchMessageLoopAsync(this.MessageHandler); } }