Inertia

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 1  →  ?path2? @ 2
/trunk/Inertia/Form1.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
@@ -7,6 +8,8 @@
using WindowsInput;
using AutoUpdaterDotNET;
using Gma.System.MouseKeyHook;
using Inertia.Properties;
using Inertia.Utilities;
 
namespace Inertia
{
@@ -43,6 +46,17 @@
InitializeComponent();
AutoUpdater.Start("http://inertia.grimore.org/update/update.xml");
 
// Upgrade settings if required.
if (!ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).HasFile)
{
Settings.Default.Upgrade();
}
 
// Bind to settings changed event.
Settings.Default.SettingsLoaded += DefaultOnSettingsLoaded;
Settings.Default.SettingsSaving += DefaultOnSettingsSaving;
Settings.Default.PropertyChanged += DefaultOnPropertyChanged;
 
_inputSimulator = new InputSimulator();
 
_globalMouseKeyHook = Hook.GlobalEvents();
@@ -73,6 +87,19 @@
 
#region Event Handlers
 
private void DefaultOnSettingsSaving(object sender, CancelEventArgs e)
{
}
 
private void DefaultOnSettingsLoaded(object sender, SettingsLoadedEventArgs e)
{
}
 
private void DefaultOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
Settings.Default.Save();
}
 
private static void GlobalMouseKeyHookMouseWheel(object sender, MouseEventArgs e)
{
var delta = Math.Abs(e.Delta);
@@ -123,6 +150,13 @@
Application.Exit();
}
 
private void LaunchOnBootToolStripMenuItem_Click(object sender, EventArgs e)
{
Settings.Default.LaunchOnBoot = ((ToolStripMenuItem) sender).Checked;
 
LaunchOnBoot.Set(Settings.Default.LaunchOnBoot);
}
 
#endregion
 
#region Private Methods