private void Publisher_StatusChanged(BluetoothLEAdvertisementPublisher sender, BluetoothLEAdvertisementPublisherStatusChangedEventArgs args) { Debug.WriteLine(args.Status); Debug.WriteLine(args.Error); lock (lockObject) { CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { switch (args.Status) { case BluetoothLEAdvertisementPublisherStatus.Waiting: TransitionToStarting.Begin(); state = DisplayStates.Wait; break; case BluetoothLEAdvertisementPublisherStatus.Started: TransitionToBroad.Begin(); state = DisplayStates.Good; break; case BluetoothLEAdvertisementPublisherStatus.Stopping: TransitionToStarting.Begin(); state = DisplayStates.Wait; break; case BluetoothLEAdvertisementPublisherStatus.Stopped: Stop.Begin(); state = DisplayStates.Done; break; case BluetoothLEAdvertisementPublisherStatus.Created: break; case BluetoothLEAdvertisementPublisherStatus.Aborted: TransitionToError.Begin(); state = DisplayStates.Error; break; } Status.Text = args.Status.ToString(); }).AsTask().Wait(); } }