Remove autohotkey and add toggle command args

This commit is contained in:
qianlifeng
2015-01-29 22:35:01 +08:00
parent 2b1e343186
commit a112c6d9ee
9 changed files with 29 additions and 92 deletions

View File

@@ -14,6 +14,7 @@ namespace Wox.CommandArgs
public void Execute(IList<string> args)
{
Console.WriteLine("test");
if (args.Count > 0)
{
string query = args[0];

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Wox.CommandArgs
{
public class ToggleCommandArg:ICommandArg
{
public string Command
{
get { return "toggle"; }
}
public void Execute(IList<string> args)
{
App.Window.ToggleWox();
}
}
}

View File

@@ -243,9 +243,6 @@ namespace Wox
public void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
{
AHKHotkey ahk = new AHKHotkey();
ahk.RegisterHotkey("#R",null);
return;
var hotkey = new HotkeyModel(hotkeyStr);
try
{
@@ -281,17 +278,21 @@ namespace Wox
}
private void OnHotkey(object sender, HotkeyEventArgs e)
{
ToggleWox();
e.Handled = true;
}
public void ToggleWox()
{
if (!IsVisible)
{
ShowWox();
UserSettingStorage.Instance.IncreaseActivateTimes();
}
else
{
HideWox();
}
e.Handled = true;
}
private void InitProgressbarAnimation()
@@ -430,6 +431,7 @@ namespace Wox
private void ShowWox(bool selectAll = true)
{
UserSettingStorage.Instance.IncreaseActivateTimes();
if (!double.IsNaN(Left) && !double.IsNaN(Top))
{
var origScreen = Screen.FromRectangle(new Rectangle((int)Left, (int)Top, (int)ActualWidth, (int)ActualHeight));

View File

@@ -105,6 +105,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CommandArgs\ToggleCommandArg.cs" />
<Compile Include="Converters\ConvertorBase.cs" />
<Compile Include="Converters\ImagePathConverter.cs" />
<Compile Include="Converters\OpacityModeConverter.cs" />