private async void UnregisterDevice_Click(object sender, RoutedEventArgs e) { if (m_selectedDeviceId == String.Empty) { return; } await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(m_selectedDeviceId); IReadOnlyList <SecondaryAuthenticationFactorInfo> deviceList = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync( SecondaryAuthenticationFactorDeviceFindScope.User); listContent listItem = new listContent(); listItem.deviceFriendlyName = m_selectedDeviceFriendlyName; listItem.deviceGUID = m_selectedDeviceId; DeviceListBox.Items.Remove(listItem); if (deviceList.Count == 0) { this.Frame.Navigate(typeof(waitingForDevice)); } else { this.Frame.Navigate(typeof(MainPage), "false"); } }
private async void UnregisterDevices() { IReadOnlyList <SecondaryAuthenticationFactorInfo> deviceList = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync(SecondaryAuthenticationFactorDeviceFindScope.AllUsers); //DeviceListBox.Items.Clear(); for (int index = 0; index < deviceList.Count; ++index) { SecondaryAuthenticationFactorInfo deviceInfo = deviceList.ElementAt(index); System.Diagnostics.Debug.WriteLine(deviceInfo.DeviceFriendlyName); //DeviceListBox.Items.Add(deviceInfo.DeviceId); await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(deviceInfo.DeviceId); } for (int index = 0; index < deviceList.Count; ++index) { SecondaryAuthenticationFactorInfo deviceInfo = deviceList.ElementAt(index); System.Diagnostics.Debug.WriteLine(deviceInfo.DeviceFriendlyName); //DeviceListBox.Items.Add(deviceInfo.DeviceId); //await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(deviceInfo.DeviceId); } //RefreshDeviceList(deviceList); }
public static async void UnregisterAll() { var infos = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync(SecondaryAuthenticationFactorDeviceFindScope.User); foreach (var info in infos) { await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(info.DeviceId); } }
public static async Task UnregisterDevice(DeviceInfo info) { try { await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(info.DeviceId.ToString()); if ((await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync(SecondaryAuthenticationFactorDeviceFindScope.AllUsers)).Count <= 0) { BackgroundHelper.Unregister(); } } catch (Exception e) { Debug.Write(e); } }
private async void UnregisterDevice_Click(object sender, RoutedEventArgs e) { if (m_selectedDeviceId == String.Empty) { return; } //InfoList.Items.Add("Unregister a device:"); await SecondaryAuthenticationFactorRegistration.UnregisterDeviceAsync(m_selectedDeviceId); //InfoList.Items.Add("Device unregistration is completed."); IReadOnlyList <SecondaryAuthenticationFactorInfo> deviceList = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync( SecondaryAuthenticationFactorDeviceFindScope.User); RefreshDeviceList(deviceList); }