Skip to content

Commit 8496cfc

Browse files
committed
Use Ioc.Default in initialize function
1 parent e989b5a commit 8496cfc

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
111111
Current.MainWindow = window;
112112
Current.MainWindow.Title = Constant.FlowLauncher;
113113

114-
HotKeyMapper.Initialize(mainVM);
114+
HotKeyMapper.Initialize();
115115

116116
// main windows needs initialized before theme change because of blur settings
117117
// TODO: Clean ThemeManager.Instance in future

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
using NHotkey.Wpf;
66
using Flow.Launcher.Core.Resource;
77
using Flow.Launcher.ViewModel;
8-
using Flow.Launcher.Core;
98
using ChefKeys;
10-
using System.Globalization;
119
using Flow.Launcher.Infrastructure.Logger;
10+
using CommunityToolkit.Mvvm.DependencyInjection;
1211

1312
namespace Flow.Launcher.Helper;
1413

@@ -17,10 +16,10 @@ internal static class HotKeyMapper
1716
private static Settings _settings;
1817
private static MainViewModel _mainViewModel;
1918

20-
internal static void Initialize(MainViewModel mainVM)
19+
internal static void Initialize()
2120
{
22-
_mainViewModel = mainVM;
23-
_settings = _mainViewModel.Settings;
21+
_mainViewModel = Ioc.Default.GetRequiredService<MainViewModel>();
22+
_settings = Ioc.Default.GetService<Settings>();
2423

2524
SetHotkey(_settings.Hotkey, OnToggleHotkey);
2625
LoadCustomPluginHotkey();

0 commit comments

Comments
 (0)