Remove unused code and add required code for MVVM

This commit is contained in:
Colin Liu
2016-02-18 19:35:17 +08:00
parent f16804c0f8
commit e15baeb4a2
3 changed files with 18 additions and 74 deletions

View File

@@ -10,6 +10,8 @@ using Wox.CommandArgs;
using Wox.Core.Plugin;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Plugin;
using Wox.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch;
@@ -20,6 +22,8 @@ namespace Wox
private const string Unique = "Wox_Unique_Application_Mutex";
public static MainWindow Window { get; private set; }
public static IPublicAPI API { get; private set; }
[STAThread]
public static void Main()
{
@@ -40,8 +44,14 @@ namespace Wox
WoxDirectroy.Executable = Directory.GetParent(Assembly.GetExecutingAssembly().Location).ToString();
RegisterUnhandledException();
ThreadPool.QueueUserWorkItem(o => { ImageLoader.ImageLoader.PreloadImages(); });
MainViewModel mainVM = new MainViewModel();
API = new PublicAPIInstance(mainVM);
Window = new MainWindow();
PluginManager.Init(Window);
Window.DataContext = mainVM;
PluginManager.Init(API);
CommandArgsFactory.Execute(e.Args.ToList());
});
@@ -59,7 +69,7 @@ namespace Wox
{
if (args.Count > 0 && args[0] == SingleInstance<App>.Restart)
{
Window.CloseApp();
API.CloseApp();
}
else
{