Remove usage of _settingsVM._settings and make _settings private

This commit is contained in:
Jack251970 2025-02-23 22:05:49 +08:00
parent ef68ccb70a
commit 91490c0251
2 changed files with 7 additions and 5 deletions

View file

@ -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<Settings>();
_settingsVM = Ioc.Default.GetRequiredService<SettingWindowViewModel>();
_mainVM = Ioc.Default.GetRequiredService<MainViewModel>();
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;

View file

@ -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)
{