Skip to content

Commit

Permalink
Use Ioc.Default in initialize function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack251970 committed Feb 23, 2025
1 parent e989b5a commit 8496cfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Flow.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
Current.MainWindow = window;
Current.MainWindow.Title = Constant.FlowLauncher;

HotKeyMapper.Initialize(mainVM);
HotKeyMapper.Initialize();

// main windows needs initialized before theme change because of blur settings
// TODO: Clean ThemeManager.Instance in future
Expand Down
9 changes: 4 additions & 5 deletions Flow.Launcher/Helper/HotKeyMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
using NHotkey.Wpf;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.ViewModel;
using Flow.Launcher.Core;
using ChefKeys;
using System.Globalization;
using Flow.Launcher.Infrastructure.Logger;
using CommunityToolkit.Mvvm.DependencyInjection;

namespace Flow.Launcher.Helper;

Expand All @@ -17,10 +16,10 @@ internal static class HotKeyMapper
private static Settings _settings;
private static MainViewModel _mainViewModel;

internal static void Initialize(MainViewModel mainVM)
internal static void Initialize()
{
_mainViewModel = mainVM;
_settings = _mainViewModel.Settings;
_mainViewModel = Ioc.Default.GetRequiredService<MainViewModel>();
_settings = Ioc.Default.GetService<Settings>();

SetHotkey(_settings.Hotkey, OnToggleHotkey);
LoadCustomPluginHotkey();
Expand Down

0 comments on commit 8496cfc

Please sign in to comment.