示例#1
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     _DeviceWatcher          = DeviceInformation.CreateWatcher(OrpheShoe.GetDeviceSelector(), new string[] { "System.Devices.Aep.IsConnected", "System.Devices.Aep.SignalStrength", }, DeviceInformationKind.AssociationEndpoint);
     _DeviceWatcher.Added   += DeviceWatcher_Added;
     _DeviceWatcher.Updated += DeviceWatcher_Updated;
     _DeviceWatcher.Removed += DeviceWatcher_Removed;
     _DeviceWatcher.Start();
 }
 // Use this for initialization
 public void Init(string deviceName = "orphe")
 {
     Debug.Log("init");
     isConnected    = false;
     _DeviceWatcher = DeviceInformation.CreateWatcher(OrpheShoe.GetDeviceSelector(deviceName), new string[] { "System.Devices.Aep.IsConnected", "System.Devices.Aep.SignalStrength", }, DeviceInformationKind.AssociationEndpoint);
     //_DeviceWatcher = DeviceInformation.CreateWatcher("System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\"", null, DeviceInformationKind.AssociationEndpoint);
     _DeviceWatcher.Added   += DeviceWatcher_Added;
     _DeviceWatcher.Updated += DeviceWatcher_Updated;
     _DeviceWatcher.Removed += DeviceWatcher_Removed;
     _DeviceWatcher.Start();
 }