diff --git a/.gitmodules b/.gitmodules
index a081308..4437b85 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "Common"]
path = Common
- url = https://github.com/ckaczor/Common.git
+ url = https://github.com/ckaczor/Common.git
\ No newline at end of file
diff --git a/Options/AboutOptionsPanel.xaml b/Options/AboutOptionsPanel.xaml
new file mode 100644
index 0000000..09c7830
--- /dev/null
+++ b/Options/AboutOptionsPanel.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
diff --git a/Options/AboutOptionsPanel.xaml.cs b/Options/AboutOptionsPanel.xaml.cs
new file mode 100644
index 0000000..57fcb17
--- /dev/null
+++ b/Options/AboutOptionsPanel.xaml.cs
@@ -0,0 +1,36 @@
+using Common.Update;
+using System.Reflection;
+
+namespace ProcessCpuUsageStatusWindow.Options
+{
+ public partial class AboutOptionsPanel
+ {
+ public AboutOptionsPanel()
+ {
+ InitializeComponent();
+ }
+
+ public override void LoadPanel(object data)
+ {
+ base.LoadPanel(data);
+
+ ApplicationNameLabel.Text = Properties.Resources.ApplicationName;
+
+ var version = UpdateCheck.LocalVersion.ToString();
+ VersionLabel.Text = string.Format(Properties.Resources.About_Version, version);
+
+ CompanyLabel.Text = ((AssemblyCompanyAttribute)Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company;
+ }
+
+ public override bool ValidatePanel()
+ {
+ return true;
+ }
+
+ public override void SavePanel()
+ {
+ }
+
+ public override string CategoryName => Properties.Resources.OptionCategory_About;
+ }
+}
diff --git a/Options/GeneralOptionsPanel.xaml b/Options/GeneralOptionsPanel.xaml
new file mode 100644
index 0000000..8ec5671
--- /dev/null
+++ b/Options/GeneralOptionsPanel.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Options/GeneralOptionsPanel.xaml.cs b/Options/GeneralOptionsPanel.xaml.cs
new file mode 100644
index 0000000..5aeea70
--- /dev/null
+++ b/Options/GeneralOptionsPanel.xaml.cs
@@ -0,0 +1,42 @@
+using Common.Wpf.Extensions;
+using System.Windows;
+
+namespace ProcessCpuUsageStatusWindow.Options
+{
+ public partial class GeneralOptionsPanel
+ {
+ public GeneralOptionsPanel()
+ {
+ InitializeComponent();
+ }
+
+ public override void LoadPanel(object data)
+ {
+ base.LoadPanel(data);
+
+ var settings = Properties.Settings.Default;
+
+ StartWithWindows.IsChecked = settings.AutoStart;
+ NumberOfProcesses.Text = settings.ProcessCount.ToString();
+ }
+
+ public override bool ValidatePanel()
+ {
+ return true;
+ }
+
+ public override void SavePanel()
+ {
+ var settings = Properties.Settings.Default;
+
+ if (StartWithWindows.IsChecked.HasValue && settings.AutoStart != StartWithWindows.IsChecked.Value)
+ settings.AutoStart = StartWithWindows.IsChecked.Value;
+
+ settings.ProcessCount = int.Parse(NumberOfProcesses.Text);
+
+ Application.Current.SetStartWithWindows(settings.AutoStart);
+ }
+
+ public override string CategoryName => Properties.Resources.OptionCategory_General;
+ }
+}
diff --git a/ProcessCpuUsageStatusWindow.csproj b/ProcessCpuUsageStatusWindow.csproj
index 0f6d33f..2194ba7 100644
--- a/ProcessCpuUsageStatusWindow.csproj
+++ b/ProcessCpuUsageStatusWindow.csproj
@@ -103,22 +103,22 @@
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.dll
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Aero.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Metro.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.DataGrid.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.DataGrid.dll
- packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.Toolkit.dll
+ packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.Toolkit.dll
@@ -130,7 +130,21 @@
App.xaml
Code
+
+ AboutOptionsPanel.xaml
+
+
+ GeneralOptionsPanel.xaml
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
@@ -149,8 +163,9 @@
True
- ResXFileCodeGenerator
+ PublicResXFileCodeGenerator
Resources.Designer.cs
+ Designer
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 124d877..a8354db 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -1,57 +1,21 @@
using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("ProcessCpuUsageStatusWindow")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
+[assembly: AssemblyCompany("Chris Kaczor")]
[assembly: AssemblyProduct("ProcessCpuUsageStatusWindow")]
-[assembly: AssemblyCopyright("Copyright © 2014")]
+[assembly: AssemblyCopyright("Copyright © Chris Kaczor 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
+[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// 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.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]
\ No newline at end of file
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
index 73d0bb0..b79960b 100644
--- a/Properties/Resources.Designer.cs
+++ b/Properties/Resources.Designer.cs
@@ -22,7 +22,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources {
+ public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@@ -36,7 +36,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// Returns the cached ResourceManager instance used by this class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
+ public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProcessCpuUsageStatusWindow.Properties.Resources", typeof(Resources).Assembly);
@@ -51,7 +51,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// resource lookups using this strongly typed resource class.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
+ public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -60,10 +60,19 @@ namespace ProcessCpuUsageStatusWindow.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Version: {0}.
+ ///
+ public static string About_Version {
+ get {
+ return ResourceManager.GetString("About_Version", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
///
- internal static System.Drawing.Icon ApplicationIcon {
+ public static System.Drawing.Icon ApplicationIcon {
get {
object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture);
return ((System.Drawing.Icon)(obj));
@@ -73,7 +82,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
///
/// Looks up a localized string similar to Process CPU Usage.
///
- internal static string ApplicationName {
+ public static string ApplicationName {
get {
return ResourceManager.GetString("ApplicationName", resourceCulture);
}
@@ -82,7 +91,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
///
/// Looks up a localized string similar to CPU: {0,4:f1}% - Total.
///
- internal static string FooterLine {
+ public static string FooterLine {
get {
return ResourceManager.GetString("FooterLine", resourceCulture);
}
@@ -91,7 +100,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
///
/// Looks up a localized string similar to .
///
- internal static string HeaderLine {
+ public static string HeaderLine {
get {
return ResourceManager.GetString("HeaderLine", resourceCulture);
}
@@ -100,25 +109,98 @@ namespace ProcessCpuUsageStatusWindow.Properties {
///
/// Looks up a localized string similar to Loading....
///
- internal static string Loading {
+ public static string Loading {
get {
return ResourceManager.GetString("Loading", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to _Number of processes:.
+ ///
+ public static string NumberOfProcesses {
+ get {
+ return ResourceManager.GetString("NumberOfProcesses", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to About.
+ ///
+ public static string OptionCategory_About {
+ get {
+ return ResourceManager.GetString("OptionCategory_About", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to General.
+ ///
+ public static string OptionCategory_General {
+ get {
+ return ResourceManager.GetString("OptionCategory_General", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Cancel.
+ ///
+ public static string OptionsWindow_CancelButton {
+ get {
+ return ResourceManager.GetString("OptionsWindow_CancelButton", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ public static System.Drawing.Icon OptionsWindow_Icon {
+ get {
+ object obj = ResourceManager.GetObject("OptionsWindow_Icon", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to OK.
+ ///
+ public static string OptionsWindow_OkayButton {
+ get {
+ return ResourceManager.GetString("OptionsWindow_OkayButton", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Options.
+ ///
+ public static string OptionsWindow_Title {
+ get {
+ return ResourceManager.GetString("OptionsWindow_Title", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to CPU: {1,4:f1}% - {0}.
///
- internal static string ProcessLine {
+ public static string ProcessLine {
get {
return ResourceManager.GetString("ProcessLine", resourceCulture);
}
}
+ ///
+ /// Looks up a localized string similar to _Start when Windows starts.
+ ///
+ public static string StartWithWindows {
+ get {
+ return ResourceManager.GetString("StartWithWindows", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Updating application....
///
- internal static string Updating {
+ public static string Updating {
get {
return ResourceManager.GetString("Updating", resourceCulture);
}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
index 5c3204d..bc38e56 100644
--- a/Properties/Resources.resx
+++ b/Properties/Resources.resx
@@ -117,6 +117,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Version: {0}
+
..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
@@ -133,9 +136,33 @@
Loading...
+
+ _Number of processes:
+
+
+ About
+
+
+ General
+
+
+ Cancel
+
+
+ ..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ OK
+
+
+ Options
+
CPU: {1,4:f1}% - {0}
+
+ _Start when Windows starts
+
Updating application...
diff --git a/WindowSource.cs b/WindowSource.cs
index 55589a3..f87e6f8 100644
--- a/WindowSource.cs
+++ b/WindowSource.cs
@@ -1,15 +1,15 @@
-using FloatingStatusWindowLibrary;
+using Common.Wpf.Windows;
+using FloatingStatusWindowLibrary;
+using ProcessCpuUsageStatusWindow.Options;
using ProcessCpuUsageStatusWindow.Properties;
using Squirrel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
-using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Windows;
using System.Windows.Threading;
namespace ProcessCpuUsageStatusWindow
@@ -20,6 +20,8 @@ namespace ProcessCpuUsageStatusWindow
private readonly ProcessCpuUsageWatcher _processCpuUsageWatcher;
private readonly Dispatcher _dispatcher = Dispatcher.CurrentDispatcher;
+ private CategoryWindow _optionsWindow;
+
internal WindowSource()
{
_floatingStatusWindow = new FloatingStatusWindow(this);
@@ -81,25 +83,43 @@ namespace ProcessCpuUsageStatusWindow
public void ShowSettings()
{
+ var panels = new List
+ {
+ new GeneralOptionsPanel(),
+ new AboutOptionsPanel()
+ };
+
+ if (_optionsWindow == null)
+ {
+ _optionsWindow = new CategoryWindow(null, panels, Resources.ResourceManager, "OptionsWindow");
+ _optionsWindow.Closed += (o, args) => { _optionsWindow = null; };
+ }
+
+ var dialogResult = _optionsWindow.ShowDialog();
+
+ if (dialogResult.HasValue && dialogResult.Value)
+ {
+ Settings.Default.Save();
+
+ Refresh();
+ }
}
public void Refresh()
{
+ UpdateDisplay(_processCpuUsageWatcher.CurrentProcessList);
}
public string Name => Resources.ApplicationName;
public System.Drawing.Icon Icon => Resources.ApplicationIcon;
- public bool HasSettingsMenu => false;
- public bool HasRefreshMenu => false;
- public bool HasAboutMenu => true;
+ public bool HasSettingsMenu => true;
+ public bool HasRefreshMenu => true;
+ public bool HasAboutMenu => false;
public void ShowAbout()
{
- var version = Assembly.GetEntryAssembly().GetName().Version.ToString();
-
- MessageBox.Show(version);
}
public string WindowSettings
diff --git a/packages.config b/packages.config
index 55773b7..4bc1748 100644
--- a/packages.config
+++ b/packages.config
@@ -1,6 +1,7 @@
+