Move initia and save from MainViewModel to App

This commit is contained in:
bao-qian
2017-02-12 16:57:24 +00:00
parent f7c9a12510
commit 00ea4f8701
3 changed files with 33 additions and 34 deletions

View File

@@ -5,6 +5,7 @@ using System.Windows;
using Wox.Core;
using Wox.Core.Plugin;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Image;
using Wox.Infrastructure.Logger;
using Wox.Infrastructure.UserSettings;
@@ -51,7 +52,7 @@ namespace Wox
API = new PublicAPIInstance(settingVM, mainVM);
PluginManager.InitializePlugins(API);
ImageLoader.PreloadImages();
ImageLoader.Initialize();
Current.MainWindow = window;
Current.MainWindow.Title = Infrastructure.Constant.Wox;
@@ -132,6 +133,10 @@ namespace Wox
if (!_disposed)
{
Current.Dispatcher.Invoke(() => ((MainViewModel)Current.MainWindow?.DataContext)?.Save());
PluginManager.Save();
ImageLoader.Save();
_disposed = true;
}
}

View File

@@ -596,9 +596,6 @@ namespace Wox.ViewModel
_userSelectedRecordStorage.Save();
_topMostRecordStorage.Save();
PluginManager.Save();
ImageLoader.Save();
_saved = true;
}
}