/// <summary>
        /// If all the devices have been enumerated, select the device in the list we connected to. Otherwise let the EnumerationComplete event
        /// from the device watcher handle the device selection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="deviceInformation"></param>
        private void OnDeviceConnected(EventHandlerForDevice sender, DeviceInformation deviceInformation)
        {
            // Find and select our connected device
            if (isAllDevicesEnumerated)
            {
                SelectDeviceInList(EventHandlerForDevice.Current.DeviceInformation.Id);

                ButtonDisconnectFromDevice.Content = ButtonNameDisconnectFromDevice;
            }

            rootPage.NotifyUser("Connected to - " +
                                EventHandlerForDevice.Current.DeviceInformation.Id, NotifyType.StatusMessage);
        }
 /// <summary>
 /// The device was closed. If we will autoreconnect to the device, reflect that in the UI
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="deviceInformation"></param>
 private async void OnDeviceClosing(EventHandlerForDevice sender, DeviceInformation deviceInformation)
 {
     await rootPage.Dispatcher.RunAsync(
         CoreDispatcherPriority.Normal,
         new DispatchedHandler(() =>
         {
             // We were connected to the device that was unplugged, so change the "Disconnect from device" button
             // to "Do not reconnect to device"
             if (ButtonDisconnectFromDevice.IsEnabled && EventHandlerForDevice.Current.IsEnabledAutoReconnect)
             {
                 ButtonDisconnectFromDevice.Content = ButtonNameDisableReconnectToDevice;
             }
         }));
 }
 /// <summary>
 /// Creates a new instance of EventHandlerForDevice, enables auto reconnect, and uses it as the Current instance.
 /// </summary>
 public static void CreateNewEventHandlerForDevice()
 {
     eventHandlerForDevice = new EventHandlerForDevice();
 }