Skip to content

Portable Tool for an Ideal Windows Setup

-name correction

Greedeksd9d26d7dc592
diff --git a/.Source/GTweak/Core/Model/DataSystemModel.cs b/.Source/GTweak/Core/Model/DataSystemModel.cs
index d8fd0604..04c67166 100644
--- a/.Source/GTweak/Core/Model/DataSystemModel.cs
+++ b/.Source/GTweak/Core/Model/DataSystemModel.cs
@@ -4,7 +4,7 @@ namespace GTweak.Core.Model
{
internal sealed class DataSystemModel
{
- public string ItemName { get; set; }
+ public string Name { get; set; }
public string Data { get; set; }
internal int BlurValue { get; set; }
internal Visibility IpVisibility { get; set; }
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
index e9057dd9..d753448e 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemVM.cs
@@ -18,7 +18,8 @@ namespace GTweak.Core.ViewModel
get => collection;
set { collection = value; OnPropertyChanged(); }
}
- public DataSystemModel this[string name] => DisplayData.FirstOrDefault(d => d.ItemName == name);
+
+ public DataSystemModel this[string name] => DisplayData.FirstOrDefault(d => d.Name == name);
public int SetBlurValue
{
@@ -44,20 +45,20 @@ namespace GTweak.Core.ViewModel
DisplayData = new ObservableCollection<DataSystemModel>
{
- new DataSystemModel { ItemName = "Windows", Data = SystemData.СomputerСonfiguration.СonfigurationData["Windows"] },
- new DataSystemModel { ItemName = "Processes", Data = new SystemData.MonitoringSystem().GetNumberRunningProcesses },
- new DataSystemModel { ItemName = "Bios", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["BIOS"]) ? SystemData.СomputerСonfiguration.СonfigurationData["BIOS"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
- new DataSystemModel { ItemName = "MotherBr", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"]) ? SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
- new DataSystemModel { ItemName = "Cpu", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["CPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["CPU"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
- new DataSystemModel { ItemName = "Gpu", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["GPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["GPU"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
- new DataSystemModel { ItemName = "Ram", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["RAM"]) ? SystemData.СomputerСonfiguration.СonfigurationData["RAM"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
- new DataSystemModel { ItemName = "Storage", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Storage"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Storage"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
- new DataSystemModel { ItemName = "Audio", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Audio"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Audio"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
- new DataSystemModel { ItemName = "Network", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"]) ? SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
- new DataSystemModel { ItemName = "Ip", Data = SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] }
+ new DataSystemModel { Name = "Windows", Data = SystemData.СomputerСonfiguration.СonfigurationData["Windows"] },
+ new DataSystemModel { Name = "Processes", Data = new SystemData.MonitoringSystem().GetNumberRunningProcesses },
+ new DataSystemModel { Name = "Bios", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["BIOS"]) ? SystemData.СomputerСonfiguration.СonfigurationData["BIOS"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
+ new DataSystemModel { Name = "Motherboard", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"]) ? SystemData.СomputerСonfiguration.СonfigurationData["MotherBr"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
+ new DataSystemModel { Name = "Processor", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["CPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["CPU"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
+ new DataSystemModel { Name = "Graphics", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["GPU"]) ? SystemData.СomputerСonfiguration.СonfigurationData["GPU"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
+ new DataSystemModel { Name = "Memory", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["RAM"]) ? SystemData.СomputerСonfiguration.СonfigurationData["RAM"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
+ new DataSystemModel { Name = "Storage", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Storage"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Storage"] : (string)Application.Current.Resources["no_device_information_systemInformatin"] },
+ new DataSystemModel { Name = "Audio", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["Audio"]) ? SystemData.СomputerСonfiguration.СonfigurationData["Audio"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
+ new DataSystemModel { Name = "Network", Data = !string.IsNullOrEmpty(SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"]) ? SystemData.СomputerСonfiguration.СonfigurationData["NetAdapter"] : (string)Application.Current.Resources["driver_not_installed_systemInformatin"] },
+ new DataSystemModel { Name = "IpAddress", Data = SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] }
};
- if (Settings.IsHiddenIpAddress & SystemData.СomputerСonfiguration.ConnectionStatus == 0)
+ if (Settings.IsHiddenIpAddress & SystemData.СomputerСonfiguration.CurrentConnection == SystemData.СomputerСonfiguration.ConnectionStatus.Available)
{
SetBlurValue = 20;
SetVisibility = Visibility.Visible;
@@ -65,7 +66,7 @@ namespace GTweak.Core.ViewModel
else
{
SetBlurValue = 0;
- SetVisibility = SystemData.СomputerСonfiguration.ConnectionStatus == 0 ? Visibility.Visible : Visibility.Hidden;
+ SetVisibility = SystemData.СomputerСonfiguration.CurrentConnection == SystemData.СomputerСonfiguration.ConnectionStatus.Available ? Visibility.Visible : Visibility.Hidden;
}
}
}
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemData.cs b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
index 1dcbc1d0..f1afe366 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemData.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemData.cs
@@ -113,14 +113,15 @@ namespace GTweak.Utilities.Tweaks
[JsonProperty("countryCode")]
internal string Country { get; set; }
}
+ internal enum ConnectionStatus
+ {
+ Available,
+ Lose,
+ Block,
+ Limited,
+ }
- /// <summary>
- /// No connection problems - [0];
- /// Connection lose - [1];
- /// Conection block - [2];
- /// Connection limited - [3].
- /// </summary>
- internal static byte ConnectionStatus = 1;
+ internal static ConnectionStatus CurrentConnection = ConnectionStatus.Lose;
internal static string WindowsClientVersion { get; set; } = string.Empty;
@@ -270,25 +271,25 @@ namespace GTweak.Utilities.Tweaks
catch
{
СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["limited_systemInformation"];
- ConnectionStatus = 3;
+ CurrentConnection = ConnectionStatus.Limited;
}
finally
{
if (IPAddress.TryParse(clientInternetProtocol.Ip, out _) && !string.IsNullOrEmpty(clientInternetProtocol.Ip) && !string.IsNullOrEmpty(clientInternetProtocol.Country))
{
- ConnectionStatus = 0;
+ CurrentConnection = ConnectionStatus.Available;
СonfigurationData["UserIpAddress"] = clientInternetProtocol.Ip + " (" + clientInternetProtocol.Country + ")";
}
else
{
- ConnectionStatus = 2;
+ CurrentConnection = ConnectionStatus.Block;
СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_block_systemInformation"];
}
}
}
else
{
- ConnectionStatus = 1;
+ CurrentConnection = ConnectionStatus.Lose;
СonfigurationData["UserIpAddress"] = (string)Application.Current.Resources["connection_lose_systemInformation"];
}
});
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 8690d135..a1bb92bf 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -122,21 +122,21 @@
<Grid Grid.Row="1">
<StackPanel Orientation="Vertical" Margin="50,20,0,0">
<TextBlock Text="{DynamicResource title_motherbr_systemInformation}" Style="{StaticResource Text}" Foreground="{StaticResource Color_Accent}" Height="Auto" Width="Auto"/>
- <TextBlock Text="{Binding [MotherBr].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
+ <TextBlock Text="{Binding [Motherboard].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<StackPanel Orientation="Vertical" Margin="50,20,0,0">
<TextBlock Text="{DynamicResource title_cpu_systemInformation}" Style="{StaticResource Text}" Foreground="{StaticResource Color_Accent}" Height="Auto" Width="Auto"/>
- <TextBlock Text="{Binding [Cpu].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
+ <TextBlock Text="{Binding [Processor].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
</StackPanel>
</Grid>
<Grid Grid.Row="3">
<StackPanel Orientation="Vertical" Margin="50,20,0,0">
<TextBlock Text="{DynamicResource title_gpu_systemInformation}" Style="{StaticResource Text}" Foreground="{StaticResource Color_Accent}" Height="Auto" Width="Auto"/>
- <TextBlock Text="{Binding [Gpu].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
+ <TextBlock Text="{Binding [Graphics].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
</StackPanel>
</Grid>
@@ -144,7 +144,7 @@
<Grid Grid.Row="4">
<StackPanel Orientation="Vertical" Margin="50,20,0,0">
<TextBlock Text="{DynamicResource title_ram_systemInformation}" Style="{StaticResource Text}" Foreground="{StaticResource Color_Accent}" Height="Auto" Width="Auto"/>
- <TextBlock Text="{Binding [Ram].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
+ <TextBlock Text="{Binding [Memory].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand"/>
</StackPanel>
</Grid>
</Grid>
@@ -182,7 +182,7 @@
<StackPanel Orientation="Vertical" Margin="50,20,0,0">
<TextBlock Text="{DynamicResource title_ip_systemInformation}" Style="{StaticResource Text}" Foreground="{StaticResource Color_Accent}" Height="Auto" Width="Auto"/>
<StackPanel Orientation="Horizontal">
- <TextBlock x:Name="IpAddress" Text="{Binding [Ip].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand">
+ <TextBlock x:Name="IpAddress" Text="{Binding [IpAddress].Data}" Style="{StaticResource Text}" HorizontalAlignment="Left" Margin="15,0,0,0" Foreground="{StaticResource Color_Highlighted}" Height="Auto" Width="Auto" PreviewMouseLeftButtonDown="TextComputerData_PreviewMouseDown" Cursor="Hand">
<TextBlock.Effect>
<BlurEffect Radius="{Binding SetBlurValue}"/>
</TextBlock.Effect>
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index a11186d3..586ed3c6 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -26,15 +26,15 @@ namespace GTweak.View
App.LanguageChanged += delegate
{
- switch (SystemData.СomputerСonfiguration.ConnectionStatus)
+ switch (SystemData.СomputerСonfiguration.CurrentConnection)
{
- case 1:
+ case SystemData.СomputerСonfiguration.ConnectionStatus.Lose:
SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_lose_systemInformation");
break;
- case 2:
+ case SystemData.СomputerСonfiguration.ConnectionStatus.Block:
SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("connection_block_systemInformation");
break;
- case 3:
+ case SystemData.СomputerСonfiguration.ConnectionStatus.Limited:
SystemData.СomputerСonfiguration.СonfigurationData["UserIpAddress"] = (string)FindResource("limited_systemInformation");
break;
}
@@ -75,7 +75,7 @@ namespace GTweak.View
#region Animations
private void AnimationProgressBars()
{
- Parallel.Invoke(delegate
+ Dispatcher.Invoke(() =>
{
DoubleAnimation doubleAnim = new DoubleAnimation()
{
@@ -102,30 +102,34 @@ namespace GTweak.View
private void AnimationPopup()
{
- PopupCopy.IsOpen = true;
- DoubleAnimation doubleAnim = new DoubleAnimation()
+ Dispatcher.Invoke(() =>
{
- From = 0,
- To = 0.9,
- SpeedRatio = 9,
- AutoReverse = true,
- EasingFunction = new QuadraticEase(),
- Duration = TimeSpan.FromSeconds(3),
- };
- doubleAnim.Completed += delegate { PopupCopy.IsOpen = false; };
- Timeline.SetDesiredFrameRate(doubleAnim, 400);
- CopyTextToastBody.BeginAnimation(ContextMenu.OpacityProperty, doubleAnim);
+ PopupCopy.IsOpen = true;
- doubleAnim = new DoubleAnimation()
- {
- From = -20,
- To = -50,
- SpeedRatio = 8,
- EasingFunction = new QuadraticEase(),
- Duration = TimeSpan.FromSeconds(3),
- };
- Timeline.SetDesiredFrameRate(doubleAnim, 400);
- PopupCopy.BeginAnimation(Popup.VerticalOffsetProperty, doubleAnim);
+ DoubleAnimation opacityAnim = new DoubleAnimation()
+ {
+ From = 0,
+ To = 0.9,
+ SpeedRatio = 9,
+ AutoReverse = true,
+ EasingFunction = new QuadraticEase(),
+ Duration = TimeSpan.FromSeconds(3)
+ };
+ opacityAnim.Completed += delegate { PopupCopy.IsOpen = false; };
+ Timeline.SetDesiredFrameRate(opacityAnim, 400);
+ CopyTextToastBody.BeginAnimation(ContextMenu.OpacityProperty, opacityAnim);
+
+ DoubleAnimation offsetAnim = new DoubleAnimation()
+ {
+ From = -20,
+ To = -50,
+ SpeedRatio = 8,
+ EasingFunction = new QuadraticEase(),
+ Duration = TimeSpan.FromSeconds(3)
+ };
+ Timeline.SetDesiredFrameRate(offsetAnim, 400);
+ PopupCopy.BeginAnimation(Popup.VerticalOffsetProperty, offsetAnim);
+ });
}
#endregion
@@ -169,11 +173,8 @@ namespace GTweak.View
private void Page_Loaded(object sender, RoutedEventArgs e)
{
- Parallel.Invoke(delegate
- {
- CPULoad.Value = SystemData.MonitoringSystem.PercentageProcessorUsage;
- RAMLoad.Value = new SystemData.MonitoringSystem().GetMemoryUsage();
- });
+ CPULoad.Value = SystemData.MonitoringSystem.PercentageProcessorUsage;
+ RAMLoad.Value = new SystemData.MonitoringSystem().GetMemoryUsage();
}
}
}