From 94f217f4d7533e1851676494c2edad00a6940a5c Mon Sep 17 00:00:00 2001 From: Yeechan Lu Date: Sun, 30 Mar 2014 15:42:33 +0800 Subject: [PATCH 1/2] Use a better method to calculate relative coordinates while moving among screens --- Wox/MainWindow.xaml.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs index df5b560a2..b221b88fe 100644 --- a/Wox/MainWindow.xaml.cs +++ b/Wox/MainWindow.xaml.cs @@ -247,10 +247,10 @@ namespace Wox { var origScreen = Screen.FromRectangle(new Rectangle((int) Left, (int) Top, (int) ActualWidth, (int) ActualHeight)); var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position); - var croodX = (Left + ActualWidth / 2.0 - (origScreen.Bounds.Left + origScreen.Bounds.Right) / 2.0) / origScreen.Bounds.Width; - var croodY = (Top + ActualHeight / 2.0 - (origScreen.Bounds.Top + origScreen.Bounds.Bottom) / 2.0) / origScreen.Bounds.Height; - Left = croodX * screen.Bounds.Width - ActualWidth / 2.0 + (screen.Bounds.Left + screen.Bounds.Right) / 2.0; - Top = croodY * screen.Bounds.Height - ActualHeight / 2.0 + (screen.Bounds.Top + screen.Bounds.Bottom) / 2.0; + var coordX = (Left - origScreen.WorkingArea.Left)/(origScreen.WorkingArea.Width - ActualWidth); + var coordY = (Top - origScreen.WorkingArea.Top)/(origScreen.WorkingArea.Height - ActualHeight); + Left = (screen.WorkingArea.Width - ActualWidth)*coordX + screen.WorkingArea.Left; + Top = (screen.WorkingArea.Height - ActualHeight)*coordY + screen.WorkingArea.Top; } Show(); From 3d73dc2fb714c7806901f658f7fbd72e8964c79e Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Sun, 30 Mar 2014 21:51:42 +0800 Subject: [PATCH 2/2] Add restart wox command into sys plugin. --- Wox.Plugin.SystemPlugins/Sys.cs | 18 ++++++++++++++++++ Wox/Images/restart.png | Bin 0 -> 1343 bytes 2 files changed, 18 insertions(+) create mode 100644 Wox/Images/restart.png diff --git a/Wox.Plugin.SystemPlugins/Sys.cs b/Wox.Plugin.SystemPlugins/Sys.cs index 9a9d28d80..fd85057f2 100644 --- a/Wox.Plugin.SystemPlugins/Sys.cs +++ b/Wox.Plugin.SystemPlugins/Sys.cs @@ -86,6 +86,24 @@ namespace Wox.Plugin.SystemPlugins } }); availableResults.Add(new Result + { + Title = "Restart Wox", + SubTitle = "Restart Wox", + Score = 110, + IcoPath = "Images\\restart.png", + Action = (c) => + { + ProcessStartInfo Info = new ProcessStartInfo(); + Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\""; + Info.WindowStyle = ProcessWindowStyle.Hidden; + Info.CreateNoWindow = true; + Info.FileName = "cmd.exe"; + Process.Start(Info); + context.CloseApp(); + return true; + } + }); + availableResults.Add(new Result { Title = "Setting", SubTitle = "Tweak this app", diff --git a/Wox/Images/restart.png b/Wox/Images/restart.png new file mode 100644 index 0000000000000000000000000000000000000000..7230a66fcfdcbf13e46a91bf1a68896440cdcd0f GIT binary patch literal 1343 zcmV-F1;F}=P))v-l~h6^X)0o=6zis4+wJalX7(H(pzZ8-3*EKq_jdm0^83zz z&TWX4lHh+7kEQX<#&ubL2EE0m2)!yHbA*)BDIuzmvY!&tML^nYOl_I#oYDN<$^-t1 zj7cVvf%LkP`~kzi-4I5hoPcQx(yub5Hr@8b?z?5jJL5Jmy`j|Q33@*r5=QCcpiu`0 z3EG*hda)~a*STdMn=u(kaTn$H8~z3%MP@v3s}#yxGHlMW-^)+*Ovr$vc6qVS3^Yne zEwYY+_&DXwoX~5O&^tD!1cM>n5t1TDNU=m0W*z_<*^d$0?y{#9bd?>y_ecY2?&7>Y z-FHDkCPaWe8dIxhIi?@_Y4zd$@n-wf7i+V70)5+ugs}+`>xB_|BRe^3QG02fFRFpr z$10q^`nuafQaokts8HVQvZrqBTz70t3dd7=-O9W^-B&Ln#?qL2IPliRO`{XD=A7j8(zv@~2LE1*)gtg>Pd4AL7 z75k#D;K!+}>_k_p%~3)?!akYL@K=v9;ME7WS@$>r@uzFfste2a>hZvb)l+f0J%QWa zv&IY=dMT}LW&VhP4PWo%rZg+8jciOgaIgI2oqqx!*2@`lYZ#$nV+|UC4I>7c@BOea zBt@#VL8g{cGZ}CIxVU_;sZxH(8WU0$ju;p;0}HK{3gNeYTi4h=Sq1 zXZ_i$VFnmsVV{5iVd>U|S#rnMeKWCk*|ywMZ$EOqOg*}KzILRb!K?eu2*@zg3gzGC zrq13G#*$JJ{`umLkQCVfkjS-9e8?-&ENBTIX9VWuZ>`}+fx&D8*q;w~!a*9Yq(XAzH7%A2y2 zr)~UsP3@S+ECm2l3P%#R?-+&yK;MQhFS+b#xi+da#S5k&-b8NSx?^5tX*4(hkb}2Q z+23v5zvZttzuG(AK(YRsF+zJ(s?NhwA3%zIiW-AKfR8l>2LQl7-w+}`ZWLm002ovPDHLkV1jS? Bh3x