This commit is contained in:
bao-qian 2016-05-17 22:23:37 +01:00
parent 1517ae3fc9
commit 2858dce664
2 changed files with 18 additions and 6 deletions

View File

@ -1,8 +1,7 @@
<Application x:Class="Wox.App" <Application x:Class="Wox.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="OnStartup" Startup="OnStartup">
Activated="OnActivated">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@ -1,5 +1,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks;
using System.Timers;
using System.Windows; using System.Windows;
using Wox.Core; using Wox.Core;
using Wox.Core.Plugin; using Wox.Core.Plugin;
@ -53,22 +55,33 @@ namespace Wox
API = new PublicAPIInstance(_settings, vm); API = new PublicAPIInstance(_settings, vm);
PluginManager.InitializePlugins(API); PluginManager.InitializePlugins(API);
RegisterExitEvents();
Current.MainWindow = window; Current.MainWindow = window;
Current.MainWindow.Title = Infrastructure.Wox.Name; Current.MainWindow.Title = Infrastructure.Wox.Name;
RegisterExitEvents();
AutoUpdates();
window.Show(); window.Show();
}); });
} }
private void OnActivated(object sender, EventArgs e) private void AutoUpdates()
{ {
if (_settings.AutoUpdates) if (_settings.AutoUpdates)
{ {
// check udpate every 5 hours
var timer = new Timer(1000 * 60 * 60 * 5);
timer.Elapsed += (s, e) =>
{
Updater.UpdateApp();
};
timer.Start();
// check updates on startup
Updater.UpdateApp(); Updater.UpdateApp();
} }
} }
private void RegisterExitEvents() private void RegisterExitEvents()
{ {
AppDomain.CurrentDomain.ProcessExit += (s, e) => Dispose(); AppDomain.CurrentDomain.ProcessExit += (s, e) => Dispose();