This commit is contained in:
qianlifeng
2014-01-14 23:31:52 +08:00
10 changed files with 96 additions and 25 deletions

View File

@@ -7,19 +7,12 @@ using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Microsoft.Win32;
using WinAlfred.Commands;
using WinAlfred.Helper;
using WinAlfred.Plugin;
using WinAlfred.PluginLoader;
using DataFormats = System.Windows.DataFormats;
using DragDropEffects = System.Windows.DragDropEffects;
using DragEventArgs = System.Windows.DragEventArgs;
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
using MessageBox = System.Windows.MessageBox;
using Timer = System.Threading.Timer;
namespace WinAlfred
{
@@ -43,6 +36,27 @@ namespace WinAlfred
InitProgressbarAnimation();
}
private void WakeupApp()
{
//After hide winalfred in the background for a long time. It will become very slow in the next show.
//This is caused by the Virtual Mermory Page Mechanisam. So, our solution is execute some codes in every min
//which may prevent sysetem uninstall memory from RAM to disk.
System.Timers.Timer t = new System.Timers.Timer(1000 * 60 * 3) { AutoReset = true, Enabled = true };
t.Elapsed += (o, e) => Dispatcher.Invoke(new Action(() =>
{
if (Visibility != Visibility.Visible)
{
double oldLeft = Left;
Left = 20000;
ShowWinAlfred();
cmdDispatcher.DispatchCommand(new Query("qq"),false);
HideWinAlfred();
Left = oldLeft;
}
}));
}
private void InitProgressbarAnimation()
{
DoubleAnimation da = new DoubleAnimation(progressBar.X2, Width + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
@@ -188,6 +202,7 @@ namespace WinAlfred
InitialTray();
selectedRecords.LoadSelectedRecords();
SetAutoStart(true);
WakeupApp();
//var engine = new Jurassic.ScriptEngine();
//MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString());
}
@@ -258,7 +273,7 @@ namespace WinAlfred
public void CloseApp()
{
notifyIcon.Visible = false;
Close();
Environment.Exit(0);
}
public void HideApp()