Skip to content

Commit

Permalink
SystemKeyHook 依赖注入
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuLing-zhang committed Sep 26, 2024
1 parent c3d60dc commit 4123bdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ComputerLock/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ private void Init()
services.AddTransient<WindowLockScreen>();
services.AddTransient<WindowBlankScreen>();
services.AddSingleton<LockService>();
services.AddSingleton<SystemKeyHook>();
services.AddSingleton<IWindowMoving, WindowMoving>();
services.AddSingleton<IWindowTitleBar, WindowTitleBar>();
services.AddSingleton<ILocker, Locker>();
Expand Down
5 changes: 3 additions & 2 deletions src/ComputerLock/Services/LockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal class LockService
{
private bool _isLocked = false;
private readonly IServiceProvider _serviceProvider;
private readonly SystemKeyHook _systemKeyHook = new();
private readonly SystemKeyHook _systemKeyHook;
private WindowLockScreen? _windowLockScreen;
private readonly List<WindowBlankScreen> _blankScreens = [];
private readonly IStringLocalizer<Lang> _lang;
Expand All @@ -16,9 +16,10 @@ internal class LockService
private readonly TaskManagerHook _taskManagerHook;
public event EventHandler? OnLock;
public event EventHandler? OnUnlock;
public LockService(IServiceProvider serviceProvider, IStringLocalizer<Lang> lang, AppSettings appSettings, ILogger logger, TaskManagerHook taskManagerHook)
public LockService(IServiceProvider serviceProvider, SystemKeyHook systemKeyHook, IStringLocalizer<Lang> lang, AppSettings appSettings, ILogger logger, TaskManagerHook taskManagerHook)
{
_serviceProvider = serviceProvider;
_systemKeyHook = systemKeyHook;
_lang = lang;
_appSettings = appSettings;
_logger = logger;
Expand Down

0 comments on commit 4123bdb

Please sign in to comment.