Skip to content

Portable Tool for an Ideal Windows Setup

ref % of ram to background & line break for load win

Greedeks5071b2f353da
diff --git a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
index 2cb6b060..e7fcb963 100644
--- a/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
+++ b/.Source/GTweak/Utilities/Tweaks/WindowsLicense.cs
@@ -24,11 +24,8 @@ namespace GTweak.Utilities.Tweaks
internal static void LicenseStatus()
{
- Parallel.Invoke(() =>
- {
- foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = 1").Get())
- IsWindowsActivated = (uint)managementObj["LicenseStatus"] == 1;
- });
+ foreach (var managementObj in new ManagementObjectSearcher(@"root\cimv2", "SELECT LicenseStatus FROM SoftwareLicensingProduct WHERE ApplicationID = '55c92734-d682-4d71-983e-d6ec3f16059f' and LicenseStatus = 1").Get())
+ IsWindowsActivated = (uint)managementObj["LicenseStatus"] == 1;
}
internal static async Task StartActivation()
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index c65fcc90..30f7dfa3 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -22,15 +22,12 @@ namespace GTweak.View
{
private readonly SystemDiagnostics _systemDiagnostics = new SystemDiagnostics();
private readonly BackgroundQueue backgroundQueue = new BackgroundQueue();
- private readonly TimerControlManager _timer = default;
+ private TimerControlManager _timer = default;
public DataSystemView()
{
InitializeComponent();
- RAMLoad.Value = _systemDiagnostics.GetMemoryUsage;
- CPULoad.Value = MonitoringService.GetProcessorUsage;
-
App.LanguageChanged += delegate
{
Dispatcher.BeginInvoke(new Action(() =>
@@ -48,12 +45,26 @@ namespace GTweak.View
}));
};
+ StartMonitoringData();
+
+ Unloaded += delegate { _timer.Stop(); };
+ Loaded += delegate { _timer.Start(); };
+ }
+
+ private void StartMonitoringData()
+ {
+ RAMLoad.Value = Task.Run(() => _systemDiagnostics.GetMemoryUsage).Result;
+ CPULoad.Value = MonitoringService.GetProcessorUsage;
+
_timer = new TimerControlManager(TimeSpan.Zero, TimerControlManager.TimerMode.CountUp, async time =>
{
if ((int)time.TotalSeconds % 2 == 0)
{
+
await backgroundQueue.QueueTask(async delegate { await _systemDiagnostics.GetTotalProcessorUsage(); });
- AnimationProgressBars();
+ var ramTask = Task.Run(() => _systemDiagnostics.GetMemoryUsage);
+ double ram = ramTask.Result;
+ AnimationProgressBars(MonitoringService.GetProcessorUsage, ram);
_ = Dispatcher.BeginInvoke(new Action(async () =>
{
MonitoringService.GetNumberRunningProcesses = await Task.Run(() => _systemDiagnostics.GetProcessCount());
@@ -72,19 +83,17 @@ namespace GTweak.View
IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, FactoryAnimation.CreateTo(0.18, () => { SettingsEngine.IsHiddenIpAddress = false; }));
}));
});
- _timer.Start();
-
- Unloaded += delegate { _timer.Stop(); };
}
- private void AnimationProgressBars()
+ private void AnimationProgressBars(double cpuValue, double ramValue)
{
Dispatcher.BeginInvoke(new Action(() =>
{
- CPULoad.BeginAnimation(ProgressBar.ValueProperty, FactoryAnimation.CreateIn(CPULoad.Value, MonitoringService.GetProcessorUsage, 0.2));
- RAMLoad.BeginAnimation(ProgressBar.ValueProperty, FactoryAnimation.CreateIn(RAMLoad.Value, _systemDiagnostics.GetMemoryUsage, 0.2));
+ CPULoad.BeginAnimation(ProgressBar.ValueProperty, FactoryAnimation.CreateIn(CPULoad.Value, cpuValue, 0.2));
+ RAMLoad.BeginAnimation(ProgressBar.ValueProperty, FactoryAnimation.CreateIn(RAMLoad.Value, ramValue, 0.2));
}));
}
+
private void AnimationPopup()
{
PopupCopy.IsOpen = true;
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml b/.Source/GTweak/Windows/LoadingWindow.xaml
index 757d5eca..a29e8959 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml
@@ -40,7 +40,7 @@
</TextBlock.Triggers>
</TextBlock>
- <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Margin="00,20,0,0">
+ <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Margin="00,18,0,0">
<Border BorderBrush="{StaticResource Color_Accent}" CornerRadius="50" Width="75" Height="75" VerticalAlignment="Center" HorizontalAlignment="Center">
<Border CornerRadius="50">
<Border.Effect>
@@ -58,7 +58,7 @@
</Path>
</Grid>
- <TextBlock x:Name="TextLoad" Text="{DynamicResource step1_load}" Foreground="{StaticResource Color_TetBlock_Inactivity}" FontFamily="{StaticResource Jura}" FontSize="9pt" HorizontalAlignment="Center" TextAlignment="Center" FontStretch="Medium" Margin="0,14,0,0"/>
+ <TextBlock x:Name="TextLoad" Text="{DynamicResource step1_load}" MaxHeight="30" MaxWidth="160" Foreground="{StaticResource Color_TetBlock_Inactivity}" FontFamily="{StaticResource Jura}" FontSize="9pt" HorizontalAlignment="Center" TextAlignment="Center" FontStretch="Medium" TextWrapping="Wrap" Margin="0,14,0,0"/>
</StackPanel>
</Grid>