Skip to content

Commit c2ba55f

Browse files
committed
Disable win hello settings if not available
1 parent c25bb81 commit c2ba55f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Guard.WPF/Views/Pages/Settings.xaml.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public Settings()
7373
WinHelloSwitch.Checked += (sender, e) => EnableWinHello();
7474
WinHelloSwitch.Unchecked += (sender, e) => DisableWinHello();
7575

76+
CheckWindowsHelloAvailability();
77+
7678
ScreenRecordingSwitch.IsChecked = SettingsManager.Settings.PreventRecording;
7779
ScreenRecordingSwitch.Checked += (sender, e) =>
7880
{
@@ -504,5 +506,22 @@ private void WebAuthn_Button_Click(object sender, RoutedEventArgs e)
504506

505507
mainWindow.Navigate(typeof(WebAuthnPage), true);
506508
}
509+
510+
private async void CheckWindowsHelloAvailability()
511+
{
512+
if (!Auth.IsLoginEnabled())
513+
{
514+
// Switch already disabled
515+
return;
516+
}
517+
518+
var supported = await WindowsHello.IsAvailable();
519+
if (!supported)
520+
{
521+
ignoreWinHelloSwitchEvents = true;
522+
WinHelloSwitch.IsEnabled = false;
523+
ignoreWinHelloSwitchEvents = false;
524+
}
525+
}
507526
}
508527
}

0 commit comments

Comments
 (0)