diff --git a/App.config b/App.config index 8723ca1..8186670 100644 --- a/App.config +++ b/App.config @@ -22,6 +22,9 @@ True + + True + \ No newline at end of file diff --git a/App.xaml.cs b/App.xaml.cs index 90bb543..08a9d5d 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -18,6 +18,13 @@ namespace ProcessCpuUsageStatusWindow { SquirrelAwareApp.HandleEvents(); + if (Settings.Default.FirstRun) + { + Settings.Default.Upgrade(); + Settings.Default.FirstRun = false; + Settings.Default.Save(); + } + var application = new App(); application.InitializeComponent(); application.Run(); @@ -27,15 +34,13 @@ namespace ProcessCpuUsageStatusWindow { base.OnStartup(e); - Settings.Default.Upgrade(); - StartManager.ManageAutoStart = true; StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart; - StartManager.AutoStartChanged += (value => + StartManager.AutoStartChanged += value => { Settings.Default.AutoStart = value; Settings.Default.Save(); - }); + }; _windowSource = new WindowSource(); } diff --git a/ProcessCpuUsageStatusWindow.nuspec b/ProcessCpuUsageStatusWindow.nuspec index 2382c1b..8579a6f 100644 --- a/ProcessCpuUsageStatusWindow.nuspec +++ b/ProcessCpuUsageStatusWindow.nuspec @@ -2,6 +2,7 @@ ProcessCpuUsageStatusWindow + CPU Usage Status Window $version$ Chris Kaczor A "floating" status window that shows the top X processes by CPU usage. diff --git a/ProcessCpuUsageWatcher.cs b/ProcessCpuUsageWatcher.cs index dc0dbb8..e9151c0 100644 --- a/ProcessCpuUsageWatcher.cs +++ b/ProcessCpuUsageWatcher.cs @@ -76,8 +76,11 @@ namespace ProcessCpuUsageStatusWindow public void Terminate() { // Get rid of the timer - _processUpdateTimer.Stop(); - _processUpdateTimer.Dispose(); + if (_processUpdateTimer != null) + { + _processUpdateTimer.Stop(); + _processUpdateTimer.Dispose(); + } // Clear the callback _processListUpdatedCallback = null; diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 7add056..124d877 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -51,7 +51,7 @@ using System.Windows; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 5f6f8ba..b75cc97 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +12,7 @@ namespace ProcessCpuUsageStatusWindow.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -70,5 +70,17 @@ namespace ProcessCpuUsageStatusWindow.Properties { this["AutoStart"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool FirstRun { + get { + return ((bool)(this["FirstRun"])); + } + set { + this["FirstRun"] = value; + } + } } } diff --git a/Properties/Settings.settings b/Properties/Settings.settings index 6d8c7f4..250074c 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -14,5 +14,8 @@ True + + True + \ No newline at end of file