Skip to content

Portable Tool for an Ideal Windows Setup

add. output of the number of running services

Greedeks3b37c96ca4f0
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
index 17289a00..894bbead 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
@@ -67,6 +67,7 @@ namespace GTweak.Core.ViewModel
{
CreateModelCollection("Windows", SystemDiagnostics.HardwareData.OperatingSystem),
CreateModelCollection("Processes", new MonitoringService().GetNumberRunningProcesses),
+ CreateModelCollection("Services", new MonitoringService().GetNumberRunningService),
CreateModelCollection("Bios", SystemDiagnostics.HardwareData.Bios, "no_device_information_systemInformatin"),
CreateModelCollection("Mode", SystemDiagnostics.HardwareData.BiosMode, "unknown_information_systemInformatin"),
CreateModelCollection("Motherboard", SystemDiagnostics.HardwareData.Motherboard, "no_device_information_systemInformatin"),
diff --git a/.Source/GTweak/Languages/en/Localize.xaml b/.Source/GTweak/Languages/en/Localize.xaml
index 234cb171..e7bb7b34 100644
--- a/.Source/GTweak/Languages/en/Localize.xaml
+++ b/.Source/GTweak/Languages/en/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Operating system:</v:String>
- <v:String x:Key="runprocces_systemInformation">Number of running processes:</v:String>
+ <v:String x:Key="label_proc_systemInformation">Running processes:</v:String>
+ <v:String x:Key="label_svc_systemInformation">services:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">Mode:</v:String>
<v:String x:Key="title_motherbr_systemInformation">Motherboard:</v:String>
diff --git a/.Source/GTweak/Languages/fr/Localize.xaml b/.Source/GTweak/Languages/fr/Localize.xaml
index 1147e925..0709e88a 100644
--- a/.Source/GTweak/Languages/fr/Localize.xaml
+++ b/.Source/GTweak/Languages/fr/Localize.xaml
@@ -426,7 +426,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Système d’exploitation :</v:String>
- <v:String x:Key="runprocces_systemInformation">Nombre de processus en cours :</v:String>
+ <v:String x:Key="label_proc_systemInformation">Processus en cours d’exécution :</v:String>
+ <v:String x:Key="label_svc_systemInformation">services :</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS :</v:String>
<v:String x:Key="title_mode_systemInformation">Mode :</v:String>
<v:String x:Key="title_motherbr_systemInformation">Carte mère :</v:String>
diff --git a/.Source/GTweak/Languages/it/Localize.xaml b/.Source/GTweak/Languages/it/Localize.xaml
index 7d16ebf0..237eb689 100644
--- a/.Source/GTweak/Languages/it/Localize.xaml
+++ b/.Source/GTweak/Languages/it/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Sistema operativo:</v:String>
- <v:String x:Key="runprocces_systemInformation">Numero di processi in esecuzione:</v:String>
+ <v:String x:Key="label_proc_systemInformation">Processi in esecuzione:</v:String>
+ <v:String x:Key="label_svc_systemInformation">servizi:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">Modalità:</v:String>
<v:String x:Key="title_motherbr_systemInformation">Scheda madre:</v:String>
diff --git a/.Source/GTweak/Languages/ko/Localize.xaml b/.Source/GTweak/Languages/ko/Localize.xaml
index 370190e7..75c92a0d 100644
--- a/.Source/GTweak/Languages/ko/Localize.xaml
+++ b/.Source/GTweak/Languages/ko/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">운영 체제:</v:String>
- <v:String x:Key="runprocces_systemInformation">실행 중인 프로세스 번호:</v:String>
+ <v:String x:Key="label_proc_systemInformation">실행 중인 프로세스:</v:String>
+ <v:String x:Key="label_svc_systemInformation">서비스:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">모드:</v:String>
<v:String x:Key="title_cores_systemInformation">코어:</v:String>
diff --git a/.Source/GTweak/Languages/pt-br/Localize.xaml b/.Source/GTweak/Languages/pt-br/Localize.xaml
index 627ff5a1..fb81b03a 100644
--- a/.Source/GTweak/Languages/pt-br/Localize.xaml
+++ b/.Source/GTweak/Languages/pt-br/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Sistema operacional:</v:String>
- <v:String x:Key="runprocces_systemInformation">Número de processos em execução:</v:String>
+ <v:String x:Key="label_proc_systemInformation">Processos em execução:</v:String>
+ <v:String x:Key="label_svc_systemInformation">serviços:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">Modo:</v:String>
<v:String x:Key="title_motherbr_systemInformation">Placa-mãe:</v:String>
diff --git a/.Source/GTweak/Languages/ru/Localize.xaml b/.Source/GTweak/Languages/ru/Localize.xaml
index 5c993e39..11260b52 100644
--- a/.Source/GTweak/Languages/ru/Localize.xaml
+++ b/.Source/GTweak/Languages/ru/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Операционная система:</v:String>
- <v:String x:Key="runprocces_systemInformation">Кол-во запущенных процессов:</v:String>
+ <v:String x:Key="label_proc_systemInformation">Работающих процессов:</v:String>
+ <v:String x:Key="label_svc_systemInformation">служб:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">Режим:</v:String>
<v:String x:Key="title_motherbr_systemInformation">Материнская плата:</v:String>
diff --git a/.Source/GTweak/Languages/uk/Localize.xaml b/.Source/GTweak/Languages/uk/Localize.xaml
index e52cc3fb..8911a3a8 100644
--- a/.Source/GTweak/Languages/uk/Localize.xaml
+++ b/.Source/GTweak/Languages/uk/Localize.xaml
@@ -424,7 +424,8 @@
<!--#region Information System Page -->
<v:String x:Key="title_win_systemInformation">Операційна система:</v:String>
- <v:String x:Key="runprocces_systemInformation">Кількість запущених процесів:</v:String>
+ <v:String x:Key="label_proc_systemInformation">Запущені процеси:</v:String>
+ <v:String x:Key="label_svc_systemInformation">служби:</v:String>
<v:String x:Key="title_bios_systemInformation">BIOS:</v:String>
<v:String x:Key="title_mode_systemInformation">Режим:</v:String>
<v:String x:Key="title_motherbr_systemInformation">Материнська плата:</v:String>
diff --git a/.Source/GTweak/Utilities/Configuration/MonitoringService.cs b/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
index 15b49b94..ce32af30 100644
--- a/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
+++ b/.Source/GTweak/Utilities/Configuration/MonitoringService.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Management;
using System.Runtime.InteropServices;
+using System.ServiceProcess;
using System.Threading.Tasks;
namespace GTweak.Utilities.Configuration
@@ -12,8 +13,10 @@ namespace GTweak.Utilities.Configuration
{
internal event Action<DeviceType> HandleDevicesEvents;
private readonly List<ManagementEventWatcher> _eventWatchers = new List<ManagementEventWatcher>();
+ private static readonly ServiceController[] _servicesList = ServiceController.GetServices();
internal string GetNumberRunningProcesses => GetProcessCount().Result;
+ internal string GetNumberRunningService => GetServicesCount().Result;
internal int GetMemoryUsage => GetPhysicalAvailableMemory().Result;
internal static int GetProcessorUsage { get; private set; } = 1;
@@ -88,6 +91,26 @@ namespace GTweak.Utilities.Configuration
return Process.GetProcesses().Length.ToString();
});
}
+
+ private static Task<string> GetServicesCount()
+ {
+ return Task.Run(() =>
+ {
+ int number = 0;
+ foreach (ServiceController svc in _servicesList)
+ {
+ try
+ {
+ svc.Refresh();
+ if (svc.Status == ServiceControllerStatus.Running)
+ ++number;
+ }
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ }
+ return number.ToString();
+ });
+ }
+
private static Task<int> GetPhysicalAvailableMemory()
{
return Task.Run(() =>
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 6c838ab4..b1929b13 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -50,12 +50,14 @@
<Grid HorizontalAlignment="Center" Margin="0,14,0,0">
<StackPanel Orientation="Vertical">
- <StackPanel Orientation="Horizontal" Height="91">
- <TextBlock Style="{StaticResource Text}" FontSize="15pt" Width="Auto" Height="77">
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
+ <TextBlock Style="{StaticResource Text}" FontSize="15pt" TextWrapping="Wrap" VerticalAlignment="Top" Height="Auto">
<Run Foreground="{StaticResource Color_Accent}" Text="{DynamicResource title_win_systemInformation}"/>
<Run Foreground="{StaticResource Color_Highlighted}" Text="{Binding [Windows].Data}" PreviewMouseDown="HandleCopyingData_PreviewMouseDown" Cursor="Hand"/>
</TextBlock>
- <Image x:Name="ImageWindows" Height="80" Width="80" HorizontalAlignment="Right" Margin="30,0,0,0">
+
+ <Image Height="80" Width="80" HorizontalAlignment="Right" Margin="30,0,0,0">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="{StaticResource DI_LogoWin}"/>
@@ -63,9 +65,13 @@
</Image.Style>
</Image>
</StackPanel>
- <TextBlock x:Name="ViewCountProcess" HorizontalAlignment="Left" FontFamily="{StaticResource Jura}" FontSize="14" MaxWidth="300" Foreground="{StaticResource Color_Inactive}">
- <Run Text="{DynamicResource runprocces_systemInformation}"/>
- <Run Text="{Binding [Processes].Data}"/>
+
+ <TextBlock HorizontalAlignment="Left" FontFamily="{StaticResource Jura}" FontSize="14" Foreground="{StaticResource Color_Inactive}" Margin="0,5,0,0">
+ <Run Text="{DynamicResource label_proc_systemInformation}"/>
+ <Run Text="{Binding [Processes].Data, StringFormat=' {0}'}"/>
+ <Run Text=" • "/>
+ <Run Text="{DynamicResource label_svc_systemInformation}"/>
+ <Run Text="{Binding [Services].Data, StringFormat=' {0}'}"/>
</TextBlock>
</StackPanel>
</Grid>