Skip to content

Commit

Permalink
修复 读取注册表被拦截导致崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
MakesYT committed Jun 20, 2024
1 parent cc617ab commit ef8b842
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions KitopiaAvalonia/Services/ScreenCaptureWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void CaptureScreen()
{
var screen = screens.All[index];
var rect = screen.Bounds;
var window = new Windows.ScreenCaptureWindow(index)
new Windows.ScreenCaptureWindow(index)
{
Position = new PixelPoint(rect.X, rect.Y),
WindowState = WindowState.FullScreen,
Expand All @@ -33,10 +33,15 @@ public void CaptureScreen()
Topmost = true,
CanResize = false,
IsVisible = true,
};
window.MosaicImage.Source = captureAllScreen.Item2.Count > 0 ? captureAllScreen.Item2.Dequeue() : null;
window.Image.Source = captureAllScreen.Item1.Count > 0 ? captureAllScreen.Item1.Dequeue() : null;
window.Show();
MosaicImage =
{
Source = captureAllScreen.Item2.Count > 0 ? captureAllScreen.Item2.Dequeue() : null
},
Image =
{
Source = captureAllScreen.Item1.Count > 0 ? captureAllScreen.Item1.Dequeue() : null
}
}.Show();
}
}

Expand All @@ -52,7 +57,8 @@ public async Task<ScreenCaptureInfo> GetScreenCaptureInfo()
Index = -1
};
SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
Action<ScreenCaptureInfo> action = (info) => {
Action<ScreenCaptureInfo> action = (info) =>
{
screenCaptureInfo = info;
semaphore.Release();
};
Expand Down

0 comments on commit ef8b842

Please sign in to comment.