Skip to content

Portable Tool for an Ideal Windows Setup

fix visibility status for IP address section & refactor deb v5.5.2

Greedeks1f7e253f95cb
diff --git a/.Source/GTweak/Assets/UserControls/Card.xaml b/.Source/GTweak/Assets/UserControls/Card.xaml
index 5138fc28..7948381d 100644
--- a/.Source/GTweak/Assets/UserControls/Card.xaml
+++ b/.Source/GTweak/Assets/UserControls/Card.xaml
@@ -7,9 +7,7 @@
mc:Ignorable="d"
d:Height="auto" d:Width="auto" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None"
SnapsToDevicePixels="True" UseLayoutRounding="True">
-
<Grid HorizontalAlignment="Stretch">
-
<Border CornerRadius="8" Opacity="0.5" Background="{StaticResource Brush_ShadowOverlay}" IsHitTestVisible="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Border.RenderTransform>
<TranslateTransform X="3" Y="6" />
diff --git a/.Source/GTweak/Assets/UserControls/FileCard.xaml b/.Source/GTweak/Assets/UserControls/FileCard.xaml
index 0b0e830f..30070266 100644
--- a/.Source/GTweak/Assets/UserControls/FileCard.xaml
+++ b/.Source/GTweak/Assets/UserControls/FileCard.xaml
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:GTweak.Assets.UserControls"
mc:Ignorable="d"
d:Height="Auto" d:Width="Auto" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None" SnapsToDevicePixels="True"
- x:Name="root" UseLayoutRounding="True" Cursor="Hand" MaxWidth="200" >
+ x:Name="Root" UseLayoutRounding="True" Cursor="Hand" MaxWidth="200" >
<Grid Cursor="Hand">
<ProgressBar x:Name="ProgressBar" Height="4" Margin="8,0,8,0" Width="Auto" VerticalAlignment="Top" Visibility="Collapsed" Value="0" Maximum="100" Foreground="{StaticResource Brush_Accent}" />
@@ -24,10 +24,10 @@
</Grid.RowDefinitions>
<Viewbox Grid.Row="0" Width="50" Height="50" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center">
- <Image Source="{Binding IconSource,ElementName=root, TargetNullValue={StaticResource Img_BatFile}}" Stretch="Uniform"/>
+ <Image Source="{Binding IconSource,ElementName=Root,TargetNullValue={StaticResource Img_BatFile}}" Stretch="Uniform"/>
</Viewbox>
- <TextBlock Grid.Row="1" Margin="0,15,0,0" FontSize="13px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Text="{Binding FileName,ElementName=root}"
+ <TextBlock Grid.Row="1" Margin="0,15,0,0" FontSize="13px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Text="{Binding FileName,ElementName=Root}"
TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Center" MaxWidth="150" MaxHeight="200" TextTrimming="CharacterEllipsis"/>
</Grid>
</Border>
diff --git a/.Source/GTweak/Assets/UserControls/InfoCard.xaml b/.Source/GTweak/Assets/UserControls/InfoCard.xaml
index 88fdef79..fdf23661 100644
--- a/.Source/GTweak/Assets/UserControls/InfoCard.xaml
+++ b/.Source/GTweak/Assets/UserControls/InfoCard.xaml
@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GTweak.Assets.UserControls"
- mc:Ignorable="d"
+ mc:Ignorable="d" x:Name="Root"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="5">
<Border CornerRadius="8" Opacity="0.5" Background="{StaticResource Brush_ShadowOverlay}"
@@ -19,12 +19,12 @@
<StackPanel Orientation="Horizontal">
<Image x:Name="CardIcon" Height="16" Width="16" VerticalAlignment="Center"/>
- <TextBlock Margin="5,0,0,0" Text="{Binding Title, RelativeSource={RelativeSource AncestorType=UserControl}}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Accent}"/>
+ <TextBlock Margin="5,0,0,0" Text="{Binding Title, ElementName=Root}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Accent}"/>
</StackPanel>
<Border Background="{StaticResource Brush_Separator}" Height="1" CornerRadius="10" Margin="0,10,0,0"/>
- <ContentPresenter Margin="0,8,0,0" Content="{Binding CardContent, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
+ <ContentPresenter Margin="0,8,0,0" Content="{Binding CardContent, ElementName=Root}"/>
</StackPanel>
</Border>
</Grid>
diff --git a/.Source/GTweak/Assets/UserControls/InfoCard.xaml.cs b/.Source/GTweak/Assets/UserControls/InfoCard.xaml.cs
index 10f2b54f..ee715759 100644
--- a/.Source/GTweak/Assets/UserControls/InfoCard.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/InfoCard.xaml.cs
@@ -5,7 +5,6 @@ namespace GTweak.Assets.UserControls
{
public partial class InfoCard : UserControl
{
-
internal static readonly DependencyProperty IconStyleProperty =
DependencyProperty.Register(nameof(IconStyle), typeof(Style), typeof(InfoCard), new PropertyMetadata(null, OnIconStyleChanged));
diff --git a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml
index 3747c008..876d2d8b 100644
--- a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml
+++ b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml
@@ -7,7 +7,7 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
d:Height="auto" d:Width="auto" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None"
- x:Name="root" SnapsToDevicePixels="True" UseLayoutRounding="True">
+ x:Name="Root" SnapsToDevicePixels="True" UseLayoutRounding="True">
<Grid HorizontalAlignment="Left">
<Border CornerRadius="8" Opacity="0.5" Background="{StaticResource Brush_ShadowOverlay}" IsHitTestVisible="False" HorizontalAlignment="Center" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=CardBody}" Height="{Binding ActualHeight, ElementName=CardBody}">
<Border.RenderTransform>
@@ -34,8 +34,8 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
- <Image Grid.Column="0" x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon,ElementName=root}" Stretch="Uniform"/>
- <TextBlock Grid.Column="1" x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName,ElementName=root}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>
+ <Image Grid.Column="0" x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon,ElementName=Root}" Stretch="Uniform"/>
+ <TextBlock Grid.Column="1" x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName,ElementName=Root}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>
</Grid>
<Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,15,0">
@@ -52,14 +52,14 @@
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="50"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True">
+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=Root}" Value="True">
<Setter Property="CornerRadius" Value="5"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Border.Background>
- <ImageBrush ImageSource="{Binding AuthorIcon,ElementName=root}" Stretch="Uniform"/>
+ <ImageBrush ImageSource="{Binding AuthorIcon,ElementName=Root}" Stretch="Uniform"/>
</Border.Background>
</Border>
@@ -68,7 +68,7 @@
<Style TargetType="Path">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True">
+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=Root}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
@@ -84,7 +84,7 @@
<Style TargetType="Path">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True">
+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=Root}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
@@ -96,7 +96,7 @@
</Path>
</Grid>
- <TextBlock Grid.Column="1" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName,ElementName=root}" VerticalAlignment="Center" Margin="5,0,0,0" TextTrimming="CharacterEllipsis"/>
+ <TextBlock Grid.Column="1" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName,ElementName=Root}" VerticalAlignment="Center" Margin="5,0,0,0" TextTrimming="CharacterEllipsis"/>
<TextBlock Grid.Column="2" Text=" • " Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" VerticalAlignment="Center" Margin="5,0,5,0"/>
@@ -125,12 +125,12 @@
<Grid VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,3,0,0">
- <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand,ElementName=root}">
+ <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand,ElementName=Root}">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ButtonContent}">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsDownloading,ElementName=root}" Value="True">
+ <DataTrigger Binding="{Binding IsDownloading,ElementName=Root}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
@@ -143,7 +143,7 @@
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding IsDownloading,ElementName=root}" Value="True">
+ <DataTrigger Binding="{Binding IsDownloading,ElementName=Root}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
@@ -160,7 +160,7 @@
<Style TargetType="TextBlock" BasedOn="{StaticResource TextDefault}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding Progress, ElementName=root}" Value="0">
+ <DataTrigger Binding="{Binding Progress, ElementName=Root}" Value="0">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
@@ -193,7 +193,7 @@
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Visible"/>
<Style.Triggers>
- <DataTrigger Binding="{Binding Progress,ElementName=root}" Value="0">
+ <DataTrigger Binding="{Binding Progress,ElementName=Root}" Value="0">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
@@ -234,13 +234,13 @@
</Border>
<Border Background="{StaticResource Brush_Accent}" CornerRadius="10" Padding="10,3">
- <TextBlock Text="{Binding Progress, StringFormat='{}{0:0}%', ElementName=root}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+ <TextBlock Text="{Binding Progress, StringFormat='{}{0:0}%', ElementName=Root}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
</Grid>
</Grid>
- <Button Grid.Column="1" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent_Inverted}" Command="{Binding CancelCommand,ElementName=root}" Margin="10,0,0,0"/>
+ <Button Grid.Column="1" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent_Inverted}" Command="{Binding CancelCommand,ElementName=Root}" Margin="10,0,0,0"/>
</Grid>
</Grid>
diff --git a/.Source/GTweak/Core/Model/DataSystemModel.cs b/.Source/GTweak/Core/Model/DataSystemModel.cs
index 104c9d1a..53055ea7 100644
--- a/.Source/GTweak/Core/Model/DataSystemModel.cs
+++ b/.Source/GTweak/Core/Model/DataSystemModel.cs
@@ -9,7 +9,7 @@ internal sealed class DataSystemModel : ViewModelBase
private List<DataSystemModel> _items;
private bool _isEnabled;
private int _blurValue;
- private Visibility _ipVisibility;
+ private Visibility _ipVisibility = Visibility.Collapsed;
public string Name { get; set; }
diff --git a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
index 5ecbed13..9d7c0e73 100644
--- a/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
+++ b/.Source/GTweak/Core/ViewModel/DataSystemViewModel.cs
@@ -18,7 +18,6 @@ namespace GTweak.Core.ViewModel
internal const string Unknown = "unknown_information_sysinfo";
internal const string NoDevice = "no_device_information_sysinfo";
internal const string NoDriver = "driver_not_installed_sysinfo";
- internal const string ConnectionLost = "connection_lose_sysinfo";
}
private readonly DataSystemModel _model = new DataSystemModel();
@@ -37,7 +36,7 @@ namespace GTweak.Core.ViewModel
public ImageSource DisplayWallpaper => HardwareData.Wallpaper;
- public int SetBlurValue
+ public int IpBlurRadius
{
get => _model.BlurValue;
set
@@ -50,7 +49,7 @@ namespace GTweak.Core.ViewModel
}
}
- public Visibility SetVisibility
+ public Visibility IpSectionVisibility
{
get => _model.IpVisibility;
set
@@ -63,7 +62,7 @@ namespace GTweak.Core.ViewModel
}
}
- public bool StateButtonVision
+ public bool IsIpHidden
{
get => SettingsEngine.IsHiddenIpAddress;
set
@@ -106,27 +105,36 @@ namespace GTweak.Core.ViewModel
CreateListCollection("Audio", () => HardwareData.AudioDevices.Select(a => new[] { a.Data, a.IsCapture ? "1" : "0" }).ToList(),true, FallbackKeys.NoDriver),
CreateListCollection("Network", () => HardwareData.NetworkAdapters.Select(n => new[] { n.Data, n.IsConnected ? "1" : "0" }).ToList(),true, FallbackKeys.NoDriver),
CreateModelCollection("CountryCode", () => HardwareData.UserCountryCode, isUpdatable: true),
- (_ipAddressModel = CreateModelCollection("IpAddress", () => HardwareData.UserIPAddress, FallbackKeys.ConnectionLost, true))
+ (_ipAddressModel = CreateModelCollection("IpAddress", () => HardwareData.UserIPAddress, NetworkProvider.GetConnectionResourceKey(), true))
};
RefreshStates();
}
- internal void RefreshFallback() => _fallbackRefresh.ForEach(action => action());
+ internal void RefreshFallback()
+ {
+ string key = NetworkProvider.GetConnectionResourceKey();
+ if (key != null)
+ {
+ HardwareData.UserIPAddress = Application.Current.Resources[key] as string;
+ }
+ _fallbackRefresh.ForEach(action => action());
+ }
+
internal void UpdateModel() => _modelUpdateActions.ForEach(action => action());
- private void RefreshStates()
+ internal void RefreshStates()
{
- if (NetworkProvider.isIPAddressFormatValid || _ipAddressModel.Data.Any(char.IsDigit))
+ if (NetworkProvider.isIPAddressFormatValid || (_ipAddressModel?.Data?.Any(char.IsDigit) == true))
{
- SetBlurValue = SettingsEngine.IsHiddenIpAddress ? 20 : 0;
- SetVisibility = Visibility.Visible;
+ IpBlurRadius = SettingsEngine.IsHiddenIpAddress ? 20 : 0;
+ IpSectionVisibility = Visibility.Visible;
_ipAddressModel.IsEnabled = true;
}
else
{
- SetBlurValue = 0;
- SetVisibility = Visibility.Hidden;
+ IpBlurRadius = 0;
+ IpSectionVisibility = Visibility.Collapsed;
_ipAddressModel.IsEnabled = false;
}
}
diff --git a/.Source/GTweak/Properties/AssemblyInfo.cs b/.Source/GTweak/Properties/AssemblyInfo.cs
index c582984f..34ea9971 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.cs
+++ b/.Source/GTweak/Properties/AssemblyInfo.cs
@@ -7,9 +7,9 @@ using System.Windows;
[assembly: AssemblyProduct("GTweak")]
[assembly: AssemblyCopyright("� 2024-2026 Greedeks")]
[assembly: AssemblyTrademark("Greedeks")]
-[assembly: AssemblyInformationalVersion("Build: 5.5.1")]
-[assembly: AssemblyVersion("5.5.43.15")]
-[assembly: AssemblyFileVersion("5.5.43.15")]
+[assembly: AssemblyInformationalVersion("Build: 5.5.2")]
+[assembly: AssemblyVersion("5.5.57.945")]
+[assembly: AssemblyFileVersion("5.5.57.945")]
[assembly: ComVisible(false)]
diff --git a/.Source/GTweak/Properties/AssemblyInfo.tt b/.Source/GTweak/Properties/AssemblyInfo.tt
index 054f75f4..7317aa5f 100644
--- a/.Source/GTweak/Properties/AssemblyInfo.tt
+++ b/.Source/GTweak/Properties/AssemblyInfo.tt
@@ -22,7 +22,7 @@ using System.Windows;
[assembly: AssemblyMetadata("RepositoryType", "git")]
<#+
- private const string majorVersion = "Build: 5.5.1";
+ private const string majorVersion = "Build: 5.5.2";
private string GenerateVersion()
{
diff --git a/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs b/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs
index 4c0c358f..159ff628 100644
--- a/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs
+++ b/.Source/GTweak/Utilities/Configuration/NetworkProvider.cs
@@ -57,6 +57,14 @@ namespace GTweak.Utilities.Configuration
internal static bool isIPAddressFormatValid = false;
+ internal static string GetConnectionResourceKey() => CurrentConnection switch
+ {
+ ConnectionStatus.Lose => "connection_lose_sysinfo",
+ ConnectionStatus.Block => "connection_block_sysinfo",
+ ConnectionStatus.Limited => "connection_limited_sysinfo",
+ _ => null
+ };
+
internal async Task<bool> IsNetworkAvailable()
{
string dns = HardwareProvider.GetCurrentSystemLang().Code switch
@@ -159,17 +167,12 @@ namespace GTweak.Utilities.Configuration
CurrentConnection = ConnectionStatus.Lose;
}
- if (new Dictionary<ConnectionStatus, string>
- {
- { ConnectionStatus.Lose, "connection_lose_sysinfo" },
- { ConnectionStatus.Block, "connection_block_sysinfo" },
- { ConnectionStatus.Limited, "connection_limited_sysinfo" }
- }.TryGetValue(CurrentConnection, out string resourceKey))
+ string key = GetConnectionResourceKey();
+ if (key != null)
{
UserCountryCode = string.Empty;
- UserIPAddress = (string)Application.Current.Resources[resourceKey];
+ UserIPAddress = Application.Current.Resources[key] as string ?? string.Empty;
}
-
isIPAddressFormatValid = UserIPAddress.Any(char.IsDigit);
}
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index a10ffd95..a279c575 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -711,33 +711,24 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Text="{Binding [IpAddress].Data}" IsEnabled="{Binding [IpAddress].IsEnabled}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="HandleCopyingData_PreviewMouseDown" Cursor="Hand" anim:BlurAnimation.TargetRadius="{Binding SetBlurValue}">
+ <TextBlock Grid.Column="0" Text="{Binding [IpAddress].Data}" IsEnabled="{Binding [IpAddress].IsEnabled}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" PreviewMouseLeftButtonDown="HandleCopyingData_PreviewMouseDown" Cursor="Hand" anim:BlurAnimation.TargetRadius="{Binding IpBlurRadius}">
<TextBlock.Effect>
- <BlurEffect Radius="{Binding SetBlurValue}"/>
+ <BlurEffect Radius="{Binding IpBlurRadius}"/>
</TextBlock.Effect>
</TextBlock>
- <Border Grid.Column="2" Padding="8,2" CornerRadius="5" Background="{StaticResource Brush_Background_Labels}" VerticalAlignment="Center">
+ <Border Grid.Column="2" Padding="8,2" CornerRadius="5" Background="{StaticResource Brush_Background_Labels}" Visibility="{Binding IpSectionVisibility}" VerticalAlignment="Center" anim:BlurAnimation.TargetRadius="{Binding IpBlurRadius}">
<Border.Effect>
- <BlurEffect Radius="{Binding SetBlurValue}"/>
+ <BlurEffect Radius="{Binding IpBlurRadius}"/>
</Border.Effect>
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Visibility" Value="{Binding SetVisibility}"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding [CountryCode].Data, FallbackValue='', TargetNullValue=''}" Value="">
- <Setter Property="Visibility" Value="Collapsed"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <TextBlock Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Accent}" Text="{Binding [CountryCode].Data}"/>
+ <TextBlock Style="{StaticResource TextDefault}" FontSize="14" Foreground="{StaticResource Brush_Accent}" Text="{Binding [CountryCode].Data}"/>
</Border>
- <ToggleButton Grid.Column="4" Width="24" Height="24" Visibility="{Binding SetVisibility}" VerticalAlignment="Center" Style="{StaticResource TglVision}" IsChecked="{Binding StateButtonVision, Mode=TwoWay}"/>
+ <ToggleButton Grid.Column="4" Width="24" Height="24" Visibility="{Binding IpSectionVisibility}" VerticalAlignment="Center" Style="{StaticResource TglVision}" IsChecked="{Binding IsIpHidden, Mode=TwoWay}"/>
</Grid>
</uc:InfoCard.CardContent>
</uc:InfoCard>
+
</StackPanel>
</uc:FlowPanel>
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index 87e1e10b..58d7bcac 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
@@ -43,21 +42,10 @@ namespace GTweak.View
private void OnLanguageChanged(object sender, EventArgs e)
{
- Dispatcher.BeginInvoke(new Action(() =>
+ if (DataContext as DataSystemViewModel is var vm && vm != null)
{
- if (new Dictionary<HardwareData.ConnectionStatus, string>
- {
- { HardwareData.ConnectionStatus.Lose, "connection_lose_sysinfo" },
- { HardwareData.ConnectionStatus.Block, "connection_block_sysinfo" },
- { HardwareData.ConnectionStatus.Limited, "connection_limited_sysinfo" }
- }.TryGetValue(HardwareData.CurrentConnection, out string resourceKey))
- {
- HardwareData.UserIPAddress = (string)FindResource(resourceKey);
- UpdateDataContext();
- }
-
- (DataContext as DataSystemViewModel)?.RefreshFallback();
- }));
+ vm.RefreshFallback();
+ }
}
private void StartMonitoringData()
@@ -68,13 +56,16 @@ namespace GTweak.View
{
await backgroundQueue.QueueTask(async () =>
{
- await Task.WhenAll(_hardwareProvider.GetTotalProcessorUsage(), _hardwareProvider.GetPhysicalAvailableMemory(),
- _hardwareProvider.GetProcessCount(), _hardwareProvider.GetServicesCount());
+ await Task.WhenAll(_hardwareProvider.GetTotalProcessorUsage(), _hardwareProvider.GetPhysicalAvailableMemory(), _hardwareProvider.GetProcessCount(), _hardwareProvider.GetServicesCount());
});
_ = Dispatcher.BeginInvoke(new Action(() =>
{
- UpdateDataContext();
+ if (DataContext as DataSystemViewModel is var vm && vm != null)
+ {
+ vm.UpdateModel();
+ vm.RefreshStates();
+ }
}));
}
if ((int)time.TotalSeconds % 5 == 0)
@@ -84,14 +75,6 @@ namespace GTweak.View
});
}
- private void UpdateDataContext()
- {
- if (DataContext as DataSystemViewModel is var vm && vm != null)
- {
- vm.UpdateModel();
- }
- }
-
private void HandleCopyingData_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
object source = e.OriginalSource;