protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Attach handlers for suspension to stop the watcher when the App is suspended.
App.Current.Suspending += App_Suspending;
App.Current.Resuming += App_Resuming;
// Attach a handler to process the received advertisement.
// The watcher cannot be started without a Received handler attached
watcher.Received += OnAdvertisementReceived;
// Attach a handler to process watcher stopping due to various conditions,
// such as the Bluetooth radio turning off or the Stop method was called
watcher.Stopped += OnAdvertisementWatcherStopped;
watcher.Start();
}