예제 #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (_LineWatcher == null)
            {
                PhoneCallStore store = await PhoneCallManager.RequestStoreAsync();

                _LineWatcher              = store.RequestLineWatcher();
                _LineWatcher.LineAdded   += _watcher_LineAdded;
                _LineWatcher.LineRemoved += _watcher_LineRemoved;

                _LineWatcher.Start();
            }
            string str = PhoneLineTransportDevice.GetDeviceSelector(PhoneLineTransport.Bluetooth);

            if (_DeviceWatcher == null)
            {
                _DeviceWatcher          = DeviceInformation.CreateWatcher(str);
                _DeviceWatcher.Added   += _DeviceWatcher_Added;
                _DeviceWatcher.Removed += _DeviceWatcher_Removed;

                _DeviceWatcher.Start();
            }

            string str1  = BluetoothDevice.GetDeviceSelector();
            var    watch = DeviceInformation.CreateWatcher(str1);

            watch.Added   += _DeviceWatcher_Added;
            watch.Removed += _DeviceWatcher_Removed;
            watch.Start();
        }
예제 #2
0
        private async void _PLTDList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ViewModel.RegistrationStatus = string.Empty;

            PhoneLineTransportDevice device = PhoneLineTransportDevice.FromId(ViewModel.SelectedDevice.Id);

            if (device == null)
            {
                return;
            }

            SelectedDevice = device;
            var result = await device.RequestAccessAsync();

            if (result != DeviceAccessStatus.Allowed)
            {
                ViewModel.RegistrationStatus = result.ToString();
            }
            RefreashRegStatus();
        }