mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
@@ -3,8 +3,10 @@ using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using Wox.Core;
|
||||
using Wox.Core.Plugin;
|
||||
using Wox.Core.UserSettings;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure.Image;
|
||||
using Wox.Infrastructure.Storage;
|
||||
using Wox.ViewModel;
|
||||
using Stopwatch = Wox.Infrastructure.Stopwatch;
|
||||
|
||||
@@ -38,11 +40,15 @@ namespace Wox
|
||||
|
||||
ImageLoader.PreloadImages();
|
||||
|
||||
var vm = new MainViewModel();
|
||||
var pluginsSettings = vm._settings.PluginSettings;
|
||||
var window = new MainWindow(vm._settings, vm);
|
||||
API = new PublicAPIInstance(vm._settings, vm);
|
||||
PluginManager.InitializePlugins(API, pluginsSettings);
|
||||
var storage = new JsonStrorage<Settings>();
|
||||
var settings = storage.Load();
|
||||
|
||||
PluginManager.LoadPlugins(settings.PluginSettings);
|
||||
var vm = new MainViewModel(settings, storage);
|
||||
var pluginsSettings = settings.PluginSettings;
|
||||
var window = new MainWindow(settings, vm);
|
||||
API = new PublicAPIInstance(settings, vm);
|
||||
PluginManager.InitializePlugins(API);
|
||||
|
||||
RegisterExitEvents();
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@ namespace Wox.ViewModel
|
||||
private readonly JsonStrorage<QueryHistory> _queryHistoryStorage;
|
||||
private readonly JsonStrorage<UserSelectedRecord> _userSelectedRecordStorage;
|
||||
private readonly JsonStrorage<TopMostRecord> _topMostRecordStorage;
|
||||
// todo happlebao this field should be private in the future
|
||||
public readonly Settings _settings;
|
||||
private readonly Settings _settings;
|
||||
private readonly QueryHistory _queryHistory;
|
||||
private readonly UserSelectedRecord _userSelectedRecord;
|
||||
private readonly TopMostRecord _topMostRecord;
|
||||
@@ -56,15 +55,15 @@ namespace Wox.ViewModel
|
||||
|
||||
#region Constructor
|
||||
|
||||
public MainViewModel()
|
||||
public MainViewModel(Settings settings, JsonStrorage<Settings> storage)
|
||||
{
|
||||
_saved = false;
|
||||
_queryTextBeforeLoadContextMenu = "";
|
||||
_queryText = "";
|
||||
_lastQuery = new Query();
|
||||
|
||||
_settingsStorage = new JsonStrorage<Settings>();
|
||||
_settings = _settingsStorage.Load();
|
||||
_settingsStorage = storage;
|
||||
_settings = settings;
|
||||
|
||||
// happlebao todo temp fix for instance code logic
|
||||
HttpProxy.Instance.Settings = _settings;
|
||||
|
||||
Reference in New Issue
Block a user