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"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="OnStartup"
Activated="OnActivated">
Startup="OnStartup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>

View File

@ -1,5 +1,7 @@
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
using Wox.Core;
using Wox.Core.Plugin;
@ -53,22 +55,33 @@ namespace Wox
API = new PublicAPIInstance(_settings, vm);
PluginManager.InitializePlugins(API);
RegisterExitEvents();
Current.MainWindow = window;
Current.MainWindow.Title = Infrastructure.Wox.Name;
RegisterExitEvents();
AutoUpdates();
window.Show();
});
}
private void OnActivated(object sender, EventArgs e)
private void 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();
}
}
private void RegisterExitEvents()
{
AppDomain.CurrentDomain.ProcessExit += (s, e) => Dispose();