Add Windows screen QR scan support for avalonia

This commit is contained in:
2dust
2026-04-06 15:34:25 +08:00
parent 75f2cbaef9
commit 1160d8c154
4 changed files with 203 additions and 13 deletions
+10 -10
View File
@@ -162,8 +162,8 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
else
{
Title = $"{Utils.GetVersion()}";
menuAddServerViaScan.IsVisible = false;
}
menuAddServerViaScan.IsVisible = false;
if (_config.UiItem.AutoHideStartup && Utils.IsWindows())
{
@@ -336,17 +336,17 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
public async Task ScanScreenTaskAsync()
{
//ShowHideWindow(false);
ShowHideWindow(false);
NoticeManager.Instance.SendMessageAndEnqueue("Not yet implemented.(还未实现)");
await Task.CompletedTask;
//if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
//{
// //var bytes = QRCodeHelper.CaptureScreen(desktop);
// //await ViewModel?.ScanScreenResult(bytes);
//}
await Task.Delay(200);
//ShowHideWindow(true);
var bytes = QRCodeAvaloniaUtils.CaptureScreen();
if (bytes != null && ViewModel != null)
{
await ViewModel.ScanScreenResult(bytes);
}
ShowHideWindow(true);
}
private async Task ScanImageTaskAsync()