Add settings window

This commit is contained in:
2018-02-22 17:21:03 -05:00
parent 33e56dc548
commit 15a1ae0e36
11 changed files with 318 additions and 67 deletions

View File

@@ -0,0 +1,24 @@
<windows:CategoryPanel x:Class="ProcessCpuUsageStatusWindow.Options.AboutOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<Grid>
<TextBlock Text="[Application Name]"
Name="ApplicationNameLabel"
VerticalAlignment="Top"
FontWeight="Bold" />
<TextBlock Text="[Application Version]"
Margin="0,22,0,0"
Name="VersionLabel"
VerticalAlignment="Top" />
<TextBlock Text="[Company]"
Margin="0,44,0,0"
Name="CompanyLabel"
VerticalAlignment="Top" />
</Grid>
</windows:CategoryPanel>

View File

@@ -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;
}
}

View File

@@ -0,0 +1,40 @@
<windows:CategoryPanel x:Class="ProcessCpuUsageStatusWindow.Options.GeneralOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
xmlns:properties="clr-namespace:ProcessCpuUsageStatusWindow.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<CheckBox Content="{x:Static properties:Resources.StartWithWindows}"
Name="StartWithWindows"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Grid.ColumnSpan="2" />
<Label Grid.Column="0"
Grid.Row="1"
Content="{x:Static properties:Resources.NumberOfProcesses}"
Margin="0,6,6,6"
Padding="0"
VerticalContentAlignment="Center" VerticalAlignment="Center" />
<xctk:IntegerUpDown Grid.Column="1"
Grid.Row="1" x:Name="NumberOfProcesses"
Minimum="1" Maximum="20"
TextAlignment="Left" Margin="6"
Width="50"
HorizontalAlignment="Left" />
</Grid>
</windows:CategoryPanel>

View File

@@ -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;
}
}

View File

@@ -103,22 +103,22 @@
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.AvalonDock, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xceed.Wpf.DataGrid, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.DataGrid, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.DataGrid.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
</Reference> </Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL"> <Reference Include="Xceed.Wpf.Toolkit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>packages\FloatingStatusWindow.1.0.0.9\lib\net45\Xceed.Wpf.Toolkit.dll</HintPath> <HintPath>packages\Extended.Wpf.Toolkit.3.2.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -130,7 +130,21 @@
<DependentUpon>App.xaml</DependentUpon> <DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Options\AboutOptionsPanel.xaml.cs">
<DependentUpon>AboutOptionsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Options\GeneralOptionsPanel.xaml.cs">
<DependentUpon>GeneralOptionsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="WindowSource.cs" /> <Compile Include="WindowSource.cs" />
<Page Include="Options\AboutOptionsPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Options\GeneralOptionsPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ProcessCpuUsage.cs" /> <Compile Include="ProcessCpuUsage.cs" />
@@ -149,8 +163,9 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<None Include="appveyor.yml" /> <None Include="appveyor.yml" />
<None Include="LICENSE.md" /> <None Include="LICENSE.md" />

View File

@@ -1,57 +1,21 @@
using System.Reflection; using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows; 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: AssemblyTitle("ProcessCpuUsageStatusWindow")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("Chris Kaczor")]
[assembly: AssemblyProduct("ProcessCpuUsageStatusWindow")] [assembly: AssemblyProduct("ProcessCpuUsageStatusWindow")]
[assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyCopyright("Copyright © Chris Kaczor 2014")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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)] [assembly: ComVisible(false)]
//In order to begin building localizable applications, set [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> 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: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: AssemblyVersion("1.0.0.0")]
[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: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] [assembly: AssemblyMetadata("SquirrelAwareVersion", "1")]

View File

@@ -22,7 +22,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { public class Resources {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
@@ -36,7 +36,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager { public static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProcessCpuUsageStatusWindow.Properties.Resources", typeof(Resources).Assembly); 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. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture { public static global::System.Globalization.CultureInfo Culture {
get { get {
return resourceCulture; return resourceCulture;
} }
@@ -60,10 +60,19 @@ namespace ProcessCpuUsageStatusWindow.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Version: {0}.
/// </summary>
public static string About_Version {
get {
return ResourceManager.GetString("About_Version", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary> /// </summary>
internal static System.Drawing.Icon ApplicationIcon { public static System.Drawing.Icon ApplicationIcon {
get { get {
object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture); object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture);
return ((System.Drawing.Icon)(obj)); return ((System.Drawing.Icon)(obj));
@@ -73,7 +82,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to Process CPU Usage. /// Looks up a localized string similar to Process CPU Usage.
/// </summary> /// </summary>
internal static string ApplicationName { public static string ApplicationName {
get { get {
return ResourceManager.GetString("ApplicationName", resourceCulture); return ResourceManager.GetString("ApplicationName", resourceCulture);
} }
@@ -82,7 +91,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to CPU: {0,4:f1}% - Total. /// Looks up a localized string similar to CPU: {0,4:f1}% - Total.
/// </summary> /// </summary>
internal static string FooterLine { public static string FooterLine {
get { get {
return ResourceManager.GetString("FooterLine", resourceCulture); return ResourceManager.GetString("FooterLine", resourceCulture);
} }
@@ -91,7 +100,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to . /// Looks up a localized string similar to .
/// </summary> /// </summary>
internal static string HeaderLine { public static string HeaderLine {
get { get {
return ResourceManager.GetString("HeaderLine", resourceCulture); return ResourceManager.GetString("HeaderLine", resourceCulture);
} }
@@ -100,25 +109,98 @@ namespace ProcessCpuUsageStatusWindow.Properties {
/// <summary> /// <summary>
/// Looks up a localized string similar to Loading.... /// Looks up a localized string similar to Loading....
/// </summary> /// </summary>
internal static string Loading { public static string Loading {
get { get {
return ResourceManager.GetString("Loading", resourceCulture); return ResourceManager.GetString("Loading", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to _Number of processes:.
/// </summary>
public static string NumberOfProcesses {
get {
return ResourceManager.GetString("NumberOfProcesses", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>
public static string OptionCategory_About {
get {
return ResourceManager.GetString("OptionCategory_About", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to General.
/// </summary>
public static string OptionCategory_General {
get {
return ResourceManager.GetString("OptionCategory_General", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
public static string OptionsWindow_CancelButton {
get {
return ResourceManager.GetString("OptionsWindow_CancelButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon OptionsWindow_Icon {
get {
object obj = ResourceManager.GetObject("OptionsWindow_Icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
public static string OptionsWindow_OkayButton {
get {
return ResourceManager.GetString("OptionsWindow_OkayButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Options.
/// </summary>
public static string OptionsWindow_Title {
get {
return ResourceManager.GetString("OptionsWindow_Title", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to CPU: {1,4:f1}% - {0}. /// Looks up a localized string similar to CPU: {1,4:f1}% - {0}.
/// </summary> /// </summary>
internal static string ProcessLine { public static string ProcessLine {
get { get {
return ResourceManager.GetString("ProcessLine", resourceCulture); return ResourceManager.GetString("ProcessLine", resourceCulture);
} }
} }
/// <summary>
/// Looks up a localized string similar to _Start when Windows starts.
/// </summary>
public static string StartWithWindows {
get {
return ResourceManager.GetString("StartWithWindows", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Updating application.... /// Looks up a localized string similar to Updating application....
/// </summary> /// </summary>
internal static string Updating { public static string Updating {
get { get {
return ResourceManager.GetString("Updating", resourceCulture); return ResourceManager.GetString("Updating", resourceCulture);
} }

View File

@@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="About_Version" xml:space="preserve">
<value>Version: {0}</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -133,9 +136,33 @@
<data name="Loading" xml:space="preserve"> <data name="Loading" xml:space="preserve">
<value>Loading...</value> <value>Loading...</value>
</data> </data>
<data name="NumberOfProcesses" xml:space="preserve">
<value>_Number of processes:</value>
</data>
<data name="OptionCategory_About" xml:space="preserve">
<value>About</value>
</data>
<data name="OptionCategory_General" xml:space="preserve">
<value>General</value>
</data>
<data name="OptionsWindow_CancelButton" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="OptionsWindow_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ApplicationIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OptionsWindow_OkayButton" xml:space="preserve">
<value>OK</value>
</data>
<data name="OptionsWindow_Title" xml:space="preserve">
<value>Options</value>
</data>
<data name="ProcessLine" xml:space="preserve"> <data name="ProcessLine" xml:space="preserve">
<value>CPU: {1,4:f1}% - {0}</value> <value>CPU: {1,4:f1}% - {0}</value>
</data> </data>
<data name="StartWithWindows" xml:space="preserve">
<value>_Start when Windows starts</value>
</data>
<data name="Updating" xml:space="preserve"> <data name="Updating" xml:space="preserve">
<value>Updating application...</value> <value>Updating application...</value>
</data> </data>

View File

@@ -1,15 +1,15 @@
using FloatingStatusWindowLibrary; using Common.Wpf.Windows;
using FloatingStatusWindowLibrary;
using ProcessCpuUsageStatusWindow.Options;
using ProcessCpuUsageStatusWindow.Properties; using ProcessCpuUsageStatusWindow.Properties;
using Squirrel; using Squirrel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
namespace ProcessCpuUsageStatusWindow namespace ProcessCpuUsageStatusWindow
@@ -20,6 +20,8 @@ namespace ProcessCpuUsageStatusWindow
private readonly ProcessCpuUsageWatcher _processCpuUsageWatcher; private readonly ProcessCpuUsageWatcher _processCpuUsageWatcher;
private readonly Dispatcher _dispatcher = Dispatcher.CurrentDispatcher; private readonly Dispatcher _dispatcher = Dispatcher.CurrentDispatcher;
private CategoryWindow _optionsWindow;
internal WindowSource() internal WindowSource()
{ {
_floatingStatusWindow = new FloatingStatusWindow(this); _floatingStatusWindow = new FloatingStatusWindow(this);
@@ -81,25 +83,43 @@ namespace ProcessCpuUsageStatusWindow
public void ShowSettings() public void ShowSettings()
{ {
var panels = new List<CategoryPanel>
{
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() public void Refresh()
{ {
UpdateDisplay(_processCpuUsageWatcher.CurrentProcessList);
} }
public string Name => Resources.ApplicationName; public string Name => Resources.ApplicationName;
public System.Drawing.Icon Icon => Resources.ApplicationIcon; public System.Drawing.Icon Icon => Resources.ApplicationIcon;
public bool HasSettingsMenu => false; public bool HasSettingsMenu => true;
public bool HasRefreshMenu => false; public bool HasRefreshMenu => true;
public bool HasAboutMenu => true; public bool HasAboutMenu => false;
public void ShowAbout() public void ShowAbout()
{ {
var version = Assembly.GetEntryAssembly().GetName().Version.ToString();
MessageBox.Show(version);
} }
public string WindowSettings public string WindowSettings

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net45" /> <package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net45" />
<package id="Extended.Wpf.Toolkit" version="3.2.0" targetFramework="net45" />
<package id="FloatingStatusWindow" version="1.0.0.9" targetFramework="net45" /> <package id="FloatingStatusWindow" version="1.0.0.9" targetFramework="net45" />
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" /> <package id="Mono.Cecil" version="0.9.6.1" targetFramework="net45" />
<package id="SharpCompress" version="0.17.1" targetFramework="net45" /> <package id="SharpCompress" version="0.17.1" targetFramework="net45" />