diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 528f54172..6c6ba9f8c 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -27,11 +27,13 @@ using System.Diagnostics; using System.Collections.Specialized; using CommunityToolkit.Mvvm.DependencyInjection; using Flow.Launcher.Core; +using Flow.Launcher.Infrastructure.UserSettings; namespace Flow.Launcher { public class PublicAPIInstance : IPublicAPI { + private readonly Settings _settings; private readonly SettingWindowViewModel _settingsVM; private readonly MainViewModel _mainVM; @@ -39,6 +41,7 @@ namespace Flow.Launcher public PublicAPIInstance() { + _settings = Ioc.Default.GetRequiredService(); _settingsVM = Ioc.Default.GetRequiredService(); _mainVM = Ioc.Default.GetRequiredService(); GlobalHotkey.hookedKeyboardCallback = KListener_hookedKeyboardCallback; @@ -247,7 +250,7 @@ namespace Flow.Launcher public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null) { using var explorer = new Process(); - var explorerInfo = _settingsVM._settings.CustomExplorer; + var explorerInfo = _settings.CustomExplorer; explorer.StartInfo = new ProcessStartInfo { @@ -268,7 +271,7 @@ namespace Flow.Launcher { if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) { - var browserInfo = _settingsVM._settings.CustomBrowser; + var browserInfo = _settings.CustomBrowser; var path = browserInfo.Path == "*" ? "" : browserInfo.Path; diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 0a1968d9d..51afe533d 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -1,12 +1,11 @@ -using CommunityToolkit.Mvvm.DependencyInjection; -using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Plugin; namespace Flow.Launcher.ViewModel; public partial class SettingWindowViewModel : BaseModel { - public readonly Settings _settings; + private readonly Settings _settings; public SettingWindowViewModel(Settings settings) {