void OnStateChanged(BluetoothStateChangedArgs args) { switch (args.NewState) { case BluetoothState.On: _bluetoothState = BluetoothState.On; AnimationView.Animation = "loader.json"; AnimationView.IsVisible = true; labelStatus.Text = "En cours..."; labelStatusDescription.Text = "Votre Find Me est en cours de connexion"; successConnectedImage.IsVisible = false; // Start scan _bleService.TryStartScanning(true); return; case BluetoothState.Off: _bleService.StopScan(); _bluetoothState = BluetoothState.Off; AnimationView.Animation = "cloud.json"; AnimationView.IsVisible = true; labelStatus.Text = "Erreur"; labelStatusDescription.Text = "Le bluetooth de cet appareil semble désactivé."; successConnectedImage.IsVisible = false; buttonRetry.IsVisible = false; buttonStart.IsEnabled = false; return; default: return; } }
private void BluetoothLeOnStateChanged(object sender, BluetoothStateChangedArgs bluetoothStateChangedArgs) { switch (bluetoothStateChangedArgs.NewState) { case BluetoothState.Unknown: break; case BluetoothState.Unavailable: OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState)); break; case BluetoothState.Unauthorized: OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState)); break; case BluetoothState.TurningOn: break; case BluetoothState.On: break; case BluetoothState.TurningOff: break; case BluetoothState.Off: OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState)); break; default: throw new ArgumentOutOfRangeException(); } }
public void OnStateChanged(object sender, BluetoothStateChangedArgs args) { System.Diagnostics.Debug.WriteLine("State changed - New state : " + args.NewState + " Old state : " + args.OldState); // Send message MessagingCenter.Send <BLEService, BluetoothStateChangedArgs>(this, "stateChanged", args); }
private void Ble_StateChanged(object sender, BluetoothStateChangedArgs e) { Status = e.NewState switch { BluetoothState.TurningOn => AccelerometerStatus.BluetoothTurningOn, BluetoothState.On => AccelerometerStatus.NotConnected, _ => AccelerometerStatus.BluetoothTurnedOff, }; }
private void OnStateChanged(object sender, BluetoothStateChangedArgs e) { RaisePropertyChanged(nameof(IsStateOn)); RaisePropertyChanged(nameof(StateText)); }
/************************************************************************** * * Event handlers * **************************************************************************/ private void OnStateChanged(object sender, BluetoothStateChangedArgs e) { Log.Debug("MAIN", $"##### State changed to {e.NewState.ToString()}"); }
private void OnStateChanged(object sender, BluetoothStateChangedArgs e) { BleStatus = GetStateText(); }
private void OnStateChanged(object sender, BluetoothStateChangedArgs e) { }
private void OnStateChanged(object sender, BluetoothStateChangedArgs e) { btnScan.IsEnabled = e.NewState == BluetoothState.On; RefreshToast("Bluetooth State: " + e.NewState.ToString()); }
private void Ble_StateChanged(object sender, BluetoothStateChangedArgs e) { OnPropertyChanged(); }
private void OnStateChanged(object sender, BluetoothStateChangedArgs stateChangedArgs) { Debug.WriteLine($"The bluetooth state changed to {stateChangedArgs.NewState}"); }