use %APPDATA%

1. Fix can't find Result.ctor bug for plugin introduced in
c0889de1f9ae460b2cc189eb59e5bd90ddb7d17e
2. use %APPDATA% for all data, part of #389
3. MISC
This commit is contained in:
bao-qian
2016-04-27 02:15:53 +01:00
parent e96bd5a0e7
commit dc3b01dc15
22 changed files with 157 additions and 159 deletions

View File

@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Wox.CommandArgs;
using Wox.Core.Plugin;
using Wox.Helper;
using Wox.Infrastructure;
using Wox.Infrastructure.Image;
using Wox.ViewModel;
using Stopwatch = Wox.Infrastructure.Stopwatch;
@@ -40,11 +36,9 @@ namespace Wox
Stopwatch.Debug("Startup Time", () =>
{
base.OnStartup(e);
WoxDirectroy.Executable = Directory.GetParent(Assembly.GetExecutingAssembly().Location).ToString();
RegisterUnhandledException();
Task.Factory.StartNew(ImageLoader.PreloadImages);
PluginManager.Initialize();
MainViewModel mainVM = new MainViewModel();
API = new PublicAPIInstance(mainVM, mainVM._settings);

View File

@@ -38,7 +38,7 @@ namespace Wox
Storyboard.SetTargetProperty(fadeOutAnimation, new PropertyPath(TopProperty));
fadeOutStoryboard.Children.Add(fadeOutAnimation);
imgClose.Source = ImageLoader.Load(Path.Combine(WoxDirectroy.Executable, "Images\\close.png"));
imgClose.Source = ImageLoader.Load(Path.Combine(Infrastructure.Wox.ProgramPath, "Images\\close.png"));
imgClose.MouseUp += imgClose_MouseUp;
}
@@ -66,7 +66,7 @@ namespace Wox
}
if (!File.Exists(iconPath))
{
imgIco.Source = ImageLoader.Load(Path.Combine(WoxDirectroy.Executable, "Images\\app.png"));
imgIco.Source = ImageLoader.Load(Path.Combine(Infrastructure.Wox.ProgramPath, "Images\\app.png"));
}
else {
imgIco.Source = ImageLoader.Load(iconPath);

View File

@@ -118,15 +118,6 @@ namespace Wox
Application.Current.Dispatcher.Invoke(() => PluginManager.InstallPlugin(path));
}
public void ReloadPlugins()
{
Application.Current.Dispatcher.Invoke(() =>
{
PluginManager.Initialize();
PluginManager.InitializePlugins(this);
});
}
public string GetTranslation(string key)
{
return InternationalizationManager.Instance.GetTranslation(key);

View File

@@ -496,7 +496,7 @@ namespace Wox.ViewModel
Title = string.Format(executeQueryHistoryTitle,history.Query),
SubTitle = string.Format(lastExecuteTime,history.ExecutedDateTime),
IcoPath = "Images\\history.png",
PluginDirectory = WoxDirectroy.Executable,
PluginDirectory = Infrastructure.Wox.ProgramPath,
Action = _ =>{
QueryText = history.Query;
OnTextBoxSelected();
@@ -511,9 +511,11 @@ namespace Wox.ViewModel
Result menu;
if (_topMostRecord.IsTopMost(result))
{
menu = new Result(InternationalizationManager.Instance.GetTranslation("cancelTopMostInThisQuery"), "Images\\down.png")
menu = new Result
{
PluginDirectory = WoxDirectroy.Executable,
Title = InternationalizationManager.Instance.GetTranslation("cancelTopMostInThisQuery"),
IcoPath = "Images\\down.png",
PluginDirectory = Infrastructure.Wox.ProgramPath,
Action = _ =>
{
_topMostRecord.Remove(result);
@@ -524,9 +526,11 @@ namespace Wox.ViewModel
}
else
{
menu = new Result(InternationalizationManager.Instance.GetTranslation("setAsTopMostInThisQuery"), "Images\\up.png")
menu = new Result
{
PluginDirectory = WoxDirectroy.Executable,
Title = InternationalizationManager.Instance.GetTranslation("setAsTopMostInThisQuery"),
IcoPath = "Images\\up.png",
PluginDirectory = Infrastructure.Wox.ProgramPath,
Action = _ =>
{
_topMostRecord.AddOrUpdate(result);
@@ -551,8 +555,11 @@ namespace Wox.ViewModel
var icon = metadata.IcoPath;
var subtitle = $"{author}: {metadata.Author}, {website}: {metadata.Website} {version}: {metadata.Version}";
var menu = new Result(title, icon, subtitle)
var menu = new Result
{
Title = title,
IcoPath = icon,
SubTitle = subtitle,
PluginDirectory = metadata.PluginDirectory,
Action = _ => false
};