Skip to content

Portable Tool for an Ideal Windows Setup

add number animation (for proccess & services) & new font with support for tabular numbers

Greedeks09a61ccf4d38
diff --git a/.Source/GTweak/App.xaml b/.Source/GTweak/App.xaml
index 5210b48a..e82c8e92 100644
--- a/.Source/GTweak/App.xaml
+++ b/.Source/GTweak/App.xaml
@@ -10,7 +10,7 @@
<ResourceDictionary Source="Languages/en/Localize.xaml" />
<ResourceDictionary Source="Languages/LanguageCatalog.xaml" />
<ResourceDictionary Source="Core/DataTemplate.xaml" />
- <ResourceDictionary Source="Assets/Font/Font.xaml" />
+ <ResourceDictionary Source="Assets/Fonts/Fonts.xaml" />
<ResourceDictionary Source="Assets/DrawingImages/Deleted/Applications.xaml" />
<ResourceDictionary Source="Assets/DrawingImages/Installed/Applications.xaml" />
<ResourceDictionary Source="Assets/DrawingImages/Other.xaml" />
diff --git a/.Source/GTweak/Assets/Font/Font.xaml b/.Source/GTweak/Assets/Font/Font.xaml
deleted file mode 100644
index bcd177cf..00000000
--- a/.Source/GTweak/Assets/Font/Font.xaml
+++ /dev/null
@@ -1,6 +0,0 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
- <FontFamily x:Key="Jura">/Assets/Font/Jura-Medium.ttf#Jura</FontFamily>
-
-</ResourceDictionary>
\ No newline at end of file
diff --git a/.Source/GTweak/Assets/Fonts/Fonts.xaml b/.Source/GTweak/Assets/Fonts/Fonts.xaml
new file mode 100644
index 00000000..b66e3fff
--- /dev/null
+++ b/.Source/GTweak/Assets/Fonts/Fonts.xaml
@@ -0,0 +1,7 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+ <FontFamily x:Key="Jura">/Assets/Fonts/Jura-Medium.ttf#Jura</FontFamily>
+ <FontFamily x:Key="Saira">/Assets/Fonts/Saira-Medium.tff#Saira</FontFamily>
+
+</ResourceDictionary>
\ No newline at end of file
diff --git a/.Source/GTweak/Assets/Font/Jura-Medium.ttf b/.Source/GTweak/Assets/Fonts/Jura-Medium.ttf
similarity index 100%
rename from .Source/GTweak/Assets/Font/Jura-Medium.ttf
rename to .Source/GTweak/Assets/Fonts/Jura-Medium.ttf
diff --git a/.Source/GTweak/Assets/Fonts/Saira-Medium.ttf b/.Source/GTweak/Assets/Fonts/Saira-Medium.ttf
new file mode 100644
index 00000000..a4920be3
Binary files /dev/null and b/.Source/GTweak/Assets/Fonts/Saira-Medium.ttf differ
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 11e8e4a3..2b20968a 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -274,6 +274,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
+ <Compile Include="Utilities\Animation\NumberAnimation.cs" />
<Compile Include="Utilities\Controls\RunGuard.cs" />
<Compile Include="Utilities\Controls\ErrorLogging.cs" />
<Compile Include="Utilities\Animation\FactoryAnimation.cs" />
@@ -344,7 +345,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
- <Page Include="Assets\Font\Font.xaml">
+ <Page Include="Assets\Fonts\Fonts.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -577,12 +578,13 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <Resource Include="Assets\Fonts\Saira-Medium.ttf" />
<None Include="packages.config" />
<None Include="Resources\Blank.gz" />
<None Include="Resources\hosts.gz" />
<None Include="Resources\NSudoLC.gz" />
<None Include="Resources\UltPower.gz" />
- <Resource Include="Assets\Font\Jura-Medium.ttf" />
+ <Resource Include="Assets\Fonts\Jura-Medium.ttf" />
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
diff --git a/.Source/GTweak/Utilities/Animation/NumberAnimation.cs b/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
new file mode 100644
index 00000000..542ecdee
--- /dev/null
+++ b/.Source/GTweak/Utilities/Animation/NumberAnimation.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Animation;
+
+namespace GTweak.Utilities.Animation
+{
+ internal static class NumberAnimation
+ {
+ internal static readonly DependencyProperty ValueProperty = DependencyProperty.RegisterAttached("Value", typeof(int), typeof(NumberAnimation), new PropertyMetadata(0, OnValueChanged));
+
+ private static readonly DependencyProperty AnimatedValueProperty = DependencyProperty.RegisterAttached("AnimatedValue", typeof(int), typeof(NumberAnimation), new PropertyMetadata(0, OnAnimatedValueChanged));
+
+ internal static void SetValue(DependencyObject dObject, int value) => dObject.SetValue(ValueProperty, value);
+
+ internal static int GetValue(DependencyObject dObject) => (int)dObject.GetValue(ValueProperty);
+
+ private static void SetAnimatedValue(DependencyObject dObject, int value) => dObject.SetValue(AnimatedValueProperty, value);
+
+ private static void OnValueChanged(DependencyObject dObject, DependencyPropertyChangedEventArgs e)
+ {
+ if (dObject is TextBlock textBlock)
+ {
+ int newValue = (int)e.NewValue;
+
+ if (!textBlock.IsLoaded)
+ {
+ SetAnimatedValue(textBlock, newValue);
+ return;
+ }
+
+ int oldValue = (int)e.OldValue;
+
+ Int32Animation int32Anim = new Int32Animation
+ {
+ From = oldValue,
+ To = newValue,
+ Duration = TimeSpan.FromSeconds(0.5),
+ EasingFunction = new QuadraticEase { EasingMode = EasingMode.EaseOut }
+ };
+ Timeline.SetDesiredFrameRate(int32Anim, 240);
+ textBlock.BeginAnimation(AnimatedValueProperty, int32Anim);
+ }
+ }
+
+ private static void OnAnimatedValueChanged(DependencyObject dObject, DependencyPropertyChangedEventArgs e)
+ {
+ if (dObject is TextBlock textBlock)
+ textBlock.Text = string.Format(" {0}", e.NewValue.ToString());
+ }
+ }
+}
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index 6f7ab78e..33fdcaa8 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GTweak.View"
xmlns:vm="clr-namespace:GTweak.Core.ViewModel"
+ xmlns:anim="clr-namespace:GTweak.Utilities.Animation"
xmlns:xrpb="http://XamlRadialProgressBar/DotNet"
mc:Ignorable="d" d:DesignHeight="550" d:DesignWidth="1100"
Style="{StaticResource LaunchPage}">
@@ -69,10 +70,14 @@
<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}'}"/>
+ <InlineUIContainer>
+ <TextBlock anim:NumberAnimation.Value="{Binding [Processes].Data}" Text="0" Margin="0,1,0,0" FontFamily="{StaticResource Saira}" Typography.NumeralAlignment="Tabular" Typography.NumeralStyle="Lining" FontSize="13.5" Foreground="{StaticResource Color_Inactive}"/>
+ </InlineUIContainer>
<Run Text=" • "/>
<Run Text="{DynamicResource label_svc_systemInformation}"/>
- <Run Text="{Binding [Services].Data, StringFormat=' {0}'}"/>
+ <InlineUIContainer>
+ <TextBlock anim:NumberAnimation.Value="{Binding [Services].Data}" Text="0" Margin="0,1,0,0" FontFamily="{StaticResource Saira}" Typography.NumeralAlignment="Tabular" Typography.NumeralStyle="Lining" FontSize="13.5" Foreground="{StaticResource Color_Inactive}"/>
+ </InlineUIContainer>
</TextBlock>
</StackPanel>
</Grid>