Merge pull request #90 from zlsun/master

Some modifications.
This commit is contained in:
qianlifeng 2014-06-16 17:03:56 +08:00
commit 7aca726c33
9 changed files with 28 additions and 10 deletions

2
.gitignore vendored
View File

@ -117,3 +117,5 @@ UpgradeLog*.XML
Wox/Images/websearch/Thumbs.db
Wox/Images/Thumbs.db
Wox/Wox.csproj
*.sublime-*

View File

@ -44,6 +44,12 @@ namespace Wox.Infrastructure.Storage.UserSettings
[JsonProperty]
public List<WebSearch> WebSearches { get; set; }
[JsonProperty]
public double WindowLeft { get; set; }
[JsonProperty]
public double WindowTop { get; set; }
[JsonProperty]
public List<ProgramSource> ProgramSources { get; set; }

View File

@ -19,7 +19,7 @@ namespace Wox.Plugin.SystemPlugins
protected override List<Result> QueryInternal(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
List<Bookmark> returnList = bookmarks.Where(o => MatchProgram(o, fuzzyMather)).ToList();

View File

@ -33,8 +33,7 @@ namespace Wox.Plugin.SystemPlugins
protected override List<Result> QueryInternal(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery)
|| query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword
if (query.RawQuery.Length <= 2 // don't affect when user only input "e" or "i" keyword
|| !regValidExpressChar.IsMatch(query.RawQuery)
|| !IsBracketComplete(query.RawQuery)) return new List<Result>();

View File

@ -51,7 +51,7 @@ namespace Wox.Plugin.SystemPlugins.Program
protected override List<Result> QueryInternal(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
List<Program> returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();

View File

@ -25,7 +25,7 @@ namespace Wox.Plugin.SystemPlugins
protected override List<Result> QueryInternal(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery) || query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
List<Result> results = new List<Result>();
@ -94,7 +94,7 @@ namespace Wox.Plugin.SystemPlugins
Action = (c) =>
{
ProcessStartInfo Info = new ProcessStartInfo();
Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\"";
Info.Arguments = "/C sleep 1 && \"" + Application.ExecutablePath + "\"";
Info.WindowStyle = ProcessWindowStyle.Hidden;
Info.CreateNoWindow = true;
Info.FileName = "cmd.exe";

View File

@ -16,7 +16,6 @@ namespace Wox.Plugin.SystemPlugins
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.RawQuery)) return results;
foreach (PluginMetadata metadata in allPlugins.Select(o => o.Metadata))
{

View File

@ -18,7 +18,6 @@ namespace Wox.Plugin.SystemPlugins
protected override List<Result> QueryInternal(Query query)
{
List<Result> results = new List<Result>();
if (string.IsNullOrEmpty(query.ActionName)) return results;
WebSearch webSearch =
UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName && o.Enabled);

View File

@ -140,13 +140,26 @@ namespace Wox {
}
void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) {
UserSettingStorage.Instance.WindowLeft = Left;
UserSettingStorage.Instance.WindowTop = Top;
UserSettingStorage.Instance.Save();
this.HideWox();
e.Cancel = true;
}
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) {
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
if (UserSettingStorage.Instance.WindowLeft == 0
&& UserSettingStorage.Instance.WindowTop == 0)
{
Left = UserSettingStorage.Instance.WindowLeft
= (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
Top = UserSettingStorage.Instance.WindowTop
= (SystemParameters.PrimaryScreenHeight - ActualHeight) / 5;
}
else {
Left = UserSettingStorage.Instance.WindowLeft;
Top = UserSettingStorage.Instance.WindowTop;
}
Plugins.Init();