mirror of
https://github.com/ckaczor/ProcessCpuUsageStatusWindow.git
synced 2026-01-13 17:23:02 -05:00
Add setting to show process ID
This commit is contained in:
@@ -29,6 +29,9 @@
|
|||||||
<setting name="FirstRun" serializeAs="String">
|
<setting name="FirstRun" serializeAs="String">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="ShowProcessId" serializeAs="String">
|
||||||
|
<value>False</value>
|
||||||
|
</setting>
|
||||||
</ProcessCpuUsageStatusWindow.Properties.Settings>
|
</ProcessCpuUsageStatusWindow.Properties.Settings>
|
||||||
</userSettings>
|
</userSettings>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
<RowDefinition Height="Auto"></RowDefinition>
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
<RowDefinition Height="*"></RowDefinition>
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
@@ -23,20 +24,34 @@
|
|||||||
Name="StartWithWindows"
|
Name="StartWithWindows"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="0"
|
||||||
Grid.ColumnSpan="2" />
|
Grid.ColumnSpan="2" />
|
||||||
<Label Grid.Column="0"
|
<Label Grid.Column="0"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Content="{x:Static properties:Resources.NumberOfProcesses}"
|
Content="{x:Static properties:Resources.NumberOfProcesses}"
|
||||||
Margin="0,4,6,0"
|
Margin="0,4,6,4"
|
||||||
Padding="0"
|
Padding="0"
|
||||||
VerticalContentAlignment="Center" VerticalAlignment="Center" Target="{x:Reference NumberOfProcesses}" />
|
VerticalContentAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Target="{x:Reference NumberOfProcesses}" />
|
||||||
<xctk:IntegerUpDown Grid.Column="1"
|
<xctk:IntegerUpDown Grid.Column="1"
|
||||||
Grid.Row="1" x:Name="NumberOfProcesses"
|
Grid.Row="1"
|
||||||
Minimum="1" Maximum="20"
|
x:Name="NumberOfProcesses"
|
||||||
TextAlignment="Left" Margin="0,12,6,6"
|
Minimum="1"
|
||||||
|
Maximum="20"
|
||||||
|
TextAlignment="Left"
|
||||||
|
Margin="0,12,6,12"
|
||||||
Width="50"
|
Width="50"
|
||||||
VerticalContentAlignment="Center"
|
VerticalContentAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
<CheckBox Content="{x:Static properties:Resources.ShowProcessId}"
|
||||||
|
Name="ShowProcessId"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.ColumnSpan="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</windows:CategoryPanel>
|
</windows:CategoryPanel>
|
||||||
@@ -18,6 +18,7 @@ namespace ProcessCpuUsageStatusWindow.Options
|
|||||||
|
|
||||||
StartWithWindows.IsChecked = settings.AutoStart;
|
StartWithWindows.IsChecked = settings.AutoStart;
|
||||||
NumberOfProcesses.Text = settings.ProcessCount.ToString();
|
NumberOfProcesses.Text = settings.ProcessCount.ToString();
|
||||||
|
ShowProcessId.IsChecked = settings.ShowProcessId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ValidatePanel()
|
public override bool ValidatePanel()
|
||||||
@@ -34,6 +35,9 @@ namespace ProcessCpuUsageStatusWindow.Options
|
|||||||
|
|
||||||
settings.ProcessCount = int.Parse(NumberOfProcesses.Text);
|
settings.ProcessCount = int.Parse(NumberOfProcesses.Text);
|
||||||
|
|
||||||
|
if (ShowProcessId.IsChecked.HasValue && settings.ShowProcessId != ShowProcessId.IsChecked.Value)
|
||||||
|
settings.ShowProcessId = ShowProcessId.IsChecked.Value;
|
||||||
|
|
||||||
Application.Current.SetStartWithWindows(settings.AutoStart);
|
Application.Current.SetStartWithWindows(settings.AutoStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
20
Properties/Resources.Designer.cs
generated
20
Properties/Resources.Designer.cs
generated
@@ -225,7 +225,7 @@ namespace ProcessCpuUsageStatusWindow.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to CPU: {1,4:f1}% - {0} ({2}).
|
/// Looks up a localized string similar to CPU: {1,4:f1}% - {0}.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ProcessLine {
|
public static string ProcessLine {
|
||||||
get {
|
get {
|
||||||
@@ -233,6 +233,15 @@ namespace ProcessCpuUsageStatusWindow.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to CPU: {1,4:f1}% - {0} ({2}).
|
||||||
|
/// </summary>
|
||||||
|
public static string ProcessLineWithProcessId {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ProcessLineWithProcessId", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Restarting application....
|
/// Looks up a localized string similar to Restarting application....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -242,6 +251,15 @@ namespace ProcessCpuUsageStatusWindow.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Show _process ID.
|
||||||
|
/// </summary>
|
||||||
|
public static string ShowProcessId {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ShowProcessId", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to _Start when Windows starts.
|
/// Looks up a localized string similar to _Start when Windows starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
<value>Options</value>
|
<value>Options</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ProcessLine" xml:space="preserve">
|
<data name="ProcessLine" xml:space="preserve">
|
||||||
<value>CPU: {1,4:f1}% - {0} ({2})</value>
|
<value>CPU: {1,4:f1}% - {0}</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StartWithWindows" xml:space="preserve">
|
<data name="StartWithWindows" xml:space="preserve">
|
||||||
<value>_Start when Windows starts</value>
|
<value>_Start when Windows starts</value>
|
||||||
@@ -184,4 +184,10 @@
|
|||||||
<data name="RestartingAfterUpdate" xml:space="preserve">
|
<data name="RestartingAfterUpdate" xml:space="preserve">
|
||||||
<value>Restarting application...</value>
|
<value>Restarting application...</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ProcessLineWithProcessId" xml:space="preserve">
|
||||||
|
<value>CPU: {1,4:f1}% - {0} ({2})</value>
|
||||||
|
</data>
|
||||||
|
<data name="ShowProcessId" xml:space="preserve">
|
||||||
|
<value>Show _process ID</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
12
Properties/Settings.Designer.cs
generated
12
Properties/Settings.Designer.cs
generated
@@ -82,5 +82,17 @@ namespace ProcessCpuUsageStatusWindow.Properties {
|
|||||||
this["FirstRun"] = value;
|
this["FirstRun"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||||
|
public bool ShowProcessId {
|
||||||
|
get {
|
||||||
|
return ((bool)(this["ShowProcessId"]));
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
this["ShowProcessId"] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,5 +17,8 @@
|
|||||||
<Setting Name="FirstRun" Type="System.Boolean" Scope="User">
|
<Setting Name="FirstRun" Type="System.Boolean" Scope="User">
|
||||||
<Value Profile="(Default)">True</Value>
|
<Value Profile="(Default)">True</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="ShowProcessId" Type="System.Boolean" Scope="User">
|
||||||
|
<Value Profile="(Default)">False</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
@@ -155,7 +155,7 @@ namespace ProcessCpuUsageStatusWindow
|
|||||||
var processId = colonPosition == -1 ? string.Empty : processCpuUsage.ProcessName.Substring(colonPosition + 1);
|
var processId = colonPosition == -1 ? string.Empty : processCpuUsage.ProcessName.Substring(colonPosition + 1);
|
||||||
|
|
||||||
// Format the process information into a string to display
|
// Format the process information into a string to display
|
||||||
stringBuilder.AppendFormat(Resources.ProcessLine, processName, processCpuUsage.PercentUsage, processId);
|
stringBuilder.AppendFormat(Settings.Default.ShowProcessId ? Resources.ProcessLineWithProcessId : Resources.ProcessLine, processName, processCpuUsage.PercentUsage, processId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the footer line (if any)
|
// Add the footer line (if any)
|
||||||
|
|||||||
Reference in New Issue
Block a user