Skip to content

Portable Tool for an Ideal Windows Setup

fix settings panel animation stutter & optimize toggle and notification transitions

Greedeks6707094acd83
diff --git a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml
index 91a7b019..94af1d4d 100644
--- a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml
+++ b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml
@@ -21,7 +21,7 @@
</Rectangle.Fill>
</Rectangle>
- <Ellipse x:Name="Dot" Height="14" Width="14" Margin="0,0,24,0" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" RenderTransformOrigin="0.5,0.5">
+ <Ellipse x:Name="Dot" Height="14" Width="14" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" RenderTransformOrigin="0.5,0.5">
<Ellipse.CacheMode>
<BitmapCache RenderAtScale="2" />
</Ellipse.CacheMode>
@@ -32,7 +32,10 @@
<DropShadowEffect ShadowDepth="1" BlurRadius="3" Opacity="0.5"/>
</Ellipse.Effect>
<Ellipse.RenderTransform>
- <ScaleTransform x:Name="DotScale" ScaleX="1" ScaleY="1"/>
+ <TransformGroup>
+ <ScaleTransform x:Name="DotScale" ScaleX="1" ScaleY="1"/>
+ <TranslateTransform x:Name="DotTranslate" X="-12"/>
+ </TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
diff --git a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
index a714fc79..b6969149 100644
--- a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
@@ -75,24 +75,32 @@ namespace GTweak.Assets.UserControls
{
if (d is ToggleButton tbtn)
{
- tbtn.UpdateToggleState((bool)e.NewValue, !tbtn.IsLoaded);
+ tbtn.UpdateToggleState((bool)e.NewValue, !tbtn._isUserAction);
}
}
+ private const double _leftPositionX = -12.0, _rightPositionX = 12.0;
+ private bool _isUserAction = false;
+
private readonly SolidColorBrush brushOffColor = new SolidColorBrush(), brushOnColor = new SolidColorBrush(),
borderOffColor = new SolidColorBrush(), borderOnColor = new SolidColorBrush();
- private readonly Thickness _leftPosition = new Thickness(0, 0, 24, 0), _rightPosition = new Thickness(24, 0, 0, 0);
+ private Color _dotColorOn = (Color)Application.Current.Resources["Color_ToggleDot_On"], _dotColorOff = (Color)Application.Current.Resources["Color_ToggleDot_Off"];
public ToggleButton()
{
InitializeComponent();
brushOnColor.Color = (Color)Application.Current.Resources["Color_ToggleBG_On"];
+ brushOnColor.Freeze();
+
brushOffColor.Color = Colors.Transparent;
+ brushOffColor.Freeze();
borderOnColor.Color = (Color)Application.Current.Resources["Color_ToggleBG_On"];
+ borderOnColor.Freeze();
borderOffColor.Color = (Color)Application.Current.Resources["Color_ToggleBorder_Off"];
+ borderOffColor.Freeze();
IsEnabledChanged += ToggleButton_IsEnabledChanged;
@@ -166,9 +174,11 @@ namespace GTweak.Assets.UserControls
private void Toggle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
- if (IsEnabled || sender?.GetType() != typeof(TextBlock))
+ if (IsEnabled)
{
+ _isUserAction = true;
State = !State;
+ _isUserAction = false;
RaiseEvent(new RoutedEventArgs(ChangedStateEvent));
}
}
@@ -177,25 +187,25 @@ namespace GTweak.Assets.UserControls
{
if (State)
{
- AnimateToggle(_rightPosition, brushOffColor, brushOnColor, borderOffColor, borderOnColor, (Color)Application.Current.Resources["Color_ToggleDot_On"], skipAnimation, "TextToggle");
+ AnimateToggle(_rightPositionX, brushOffColor, brushOnColor, borderOffColor, borderOnColor, _dotColorOn, skipAnimation, "TextToggle");
}
else
{
- AnimateToggle(_leftPosition, brushOnColor, brushOffColor, borderOnColor, borderOffColor, (Color)Application.Current.Resources["Color_ToggleDot_Off"], skipAnimation, "TextInactivity");
+ AnimateToggle(_leftPositionX, brushOnColor, brushOffColor, borderOnColor, borderOffColor, _dotColorOff, skipAnimation, "TextInactivity");
}
}
- private void AnimateToggle(Thickness targetPosition, Brush fromBrush, Brush toBrush, Brush fromBorder, Brush toBorder, Color dotColor, bool skipAnimation, string textStyle)
+ private void AnimateToggle(double targetX, Brush fromBrush, Brush toBrush, Brush fromBorder, Brush toBorder, Color dotColor, bool skipAnimation, string textStyle)
{
if (skipAnimation)
{
- Dot?.BeginAnimation(MarginProperty, null);
+ DotTranslate?.BeginAnimation(TranslateTransform.XProperty, null);
Back?.BeginAnimation(Shape.FillProperty, null);
Back?.BeginAnimation(Shape.StrokeProperty, null);
- if (Dot != null)
+ if (DotTranslate != null)
{
- Dot.Margin = targetPosition;
+ DotTranslate.X = targetX;
}
if (Back != null)
@@ -212,42 +222,38 @@ namespace GTweak.Assets.UserControls
}
else
{
- ThicknessAnimationUsingKeyFrames marginAnimation = new ThicknessAnimationUsingKeyFrames();
- marginAnimation.KeyFrames.Add(new EasingThicknessKeyFrame(targetPosition, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)))
- {
- EasingFunction = new QuadraticEase()
- });
- Timeline.SetDesiredFrameRate(marginAnimation, 120);
- Dot?.BeginAnimation(MarginProperty, marginAnimation);
+ DotTranslate?.BeginAnimation(TranslateTransform.XProperty, AnimationFactory.CreateIn(DotTranslate.X, targetX, 0.2));
- BrushAnimation brushAnimation = new BrushAnimation
- {
- From = fromBrush,
- To = toBrush,
- Duration = TimeSpan.FromMilliseconds(100)
- };
- Timeline.SetDesiredFrameRate(brushAnimation, 120);
- Back?.BeginAnimation(Shape.FillProperty, brushAnimation);
-
- BrushAnimation borderAnimation = new BrushAnimation
- {
- From = fromBorder,
- To = toBorder,
- Duration = TimeSpan.FromMilliseconds(100)
- };
- Timeline.SetDesiredFrameRate(borderAnimation, 120);
- Back?.BeginAnimation(Shape.StrokeProperty, borderAnimation);
-
- ColorAnimation dotColorAnimation = new ColorAnimation
+ if (Back != null)
{
- To = dotColor,
- Duration = TimeSpan.FromMilliseconds(100),
- EasingFunction = new QuadraticEase()
- };
- Timeline.SetDesiredFrameRate(dotColorAnimation, 120);
+ BrushAnimation brushAnimation = new BrushAnimation
+ {
+ From = fromBrush,
+ To = toBrush,
+ Duration = TimeSpan.FromMilliseconds(100)
+ };
+ Timeline.SetDesiredFrameRate(brushAnimation, 120);
+ Back.BeginAnimation(Shape.FillProperty, brushAnimation);
+
+ BrushAnimation borderAnimation = new BrushAnimation
+ {
+ From = fromBorder,
+ To = toBorder,
+ Duration = TimeSpan.FromMilliseconds(100)
+ };
+ Timeline.SetDesiredFrameRate(borderAnimation, 120);
+ Back.BeginAnimation(Shape.StrokeProperty, borderAnimation);
+ }
if (Dot?.Fill is SolidColorBrush solidColorBrush)
{
+ ColorAnimation dotColorAnimation = new ColorAnimation
+ {
+ To = dotColor,
+ Duration = TimeSpan.FromMilliseconds(100),
+ EasingFunction = new QuadraticEase()
+ };
+ Timeline.SetDesiredFrameRate(dotColorAnimation, 120);
solidColorBrush.BeginAnimation(SolidColorBrush.ColorProperty, dotColorAnimation);
}
}
@@ -262,8 +268,8 @@ namespace GTweak.Assets.UserControls
{
if (IsEnabled && DotScale != null)
{
- DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(1, 1.1, 0.15, useCubicEase: true));
- DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(1, 1.1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(DotScale.ScaleX, 1.1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(DotScale.ScaleY, 1.1, 0.15, useCubicEase: true));
}
}
@@ -271,8 +277,8 @@ namespace GTweak.Assets.UserControls
{
if (IsEnabled && DotScale != null)
{
- DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(1.1, 1, 0.15, useCubicEase: true));
- DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(1.1, 1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleXProperty, AnimationFactory.CreateIn(DotScale.ScaleX, 1, 0.15, useCubicEase: true));
+ DotScale.BeginAnimation(ScaleTransform.ScaleYProperty, AnimationFactory.CreateIn(DotScale.ScaleY, 1, 0.15, useCubicEase: true));
}
}
}
diff --git a/.Source/GTweak/Windows/MainWindow.xaml b/.Source/GTweak/Windows/MainWindow.xaml
index 2eddfa1e..b9c36c59 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml
+++ b/.Source/GTweak/Windows/MainWindow.xaml
@@ -92,158 +92,6 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
- <Border x:Name="SettingsPanel" Panel.ZIndex="10" Grid.Column="1" Width="400" HorizontalAlignment="Right" RenderTransformOrigin="1,0" Opacity="0.97" Background="{StaticResource Brush_Background}">
- <Border.RenderTransform>
- <TranslateTransform X="400"/>
- </Border.RenderTransform>
- <Border.OpacityMask>
- <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
- <GradientStop Color="Transparent" Offset="0.0"/>
- <GradientStop Color="Black" Offset="0.03"/>
- <GradientStop Color="Black" Offset="1.0"/>
- </LinearGradientBrush>
- </Border.OpacityMask>
-
- <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
- <Grid Width="400" Margin="0">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- <RowDefinition Height="*"/>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
-
- <Grid Grid.Row="0">
- <TextBlock FontFamily="{StaticResource Jura}" Text="{DynamicResource title_settings_main}" Foreground="{StaticResource Brush_Accent}" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,10,0,0">
- <TextBlock.Effect>
- <DropShadowEffect BlurRadius="20" ShadowDepth="1" Direction="-90" Color="{StaticResource Color_Shadow}" />
- </TextBlock.Effect>
- <TextBlock.CacheMode>
- <BitmapCache RenderAtScale="2" EnableClearType="True"/>
- </TextBlock.CacheMode>
- </TextBlock>
- <Border Background="{StaticResource Brush_Separator}" Height="1.2" Width="330" VerticalAlignment="Bottom" CornerRadius="10" Margin="0,50,0,0"/>
- </Grid>
-
- <Grid Grid.Row="1">
- <StackPanel Orientation="Vertical">
- <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
- <uc:ToggleButton x:Name="BtnNotification" State="{Binding IsViewNotification}" TextResource="{DynamicResource btgl_noty_main}"/>
- </Viewbox>
-
- <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
- <uc:ToggleButton x:Name="BtnUpdate" State="{Binding IsUpdateCheckRequired}" TextResource="{DynamicResource btgl_update_main}"/>
- </Viewbox>
-
- <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
- <uc:ToggleButton x:Name="BtnTopMost" State="{Binding IsTopMost}" TextResource="{DynamicResource btgl_toast_main}"/>
- </Viewbox>
-
- <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="45" Margin="40,10,10,0">
- <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
- <TextBlock Style="{StaticResource TextDefault}" Text="{DynamicResource slider_volume_main}"/>
- <ToggleButton x:Name="BtnVolume" IsChecked="{Binding IsPlayingSound}" Width="20" Height="20" Margin="10,4,0,0" Style="{StaticResource TglVolume}"/>
- <Slider x:Name="SliderVolume" Style="{StaticResource Percent_Slider}" Value="{Binding CurrentVolume}" IsSnapToTickEnabled="True" Minimum="1" Maximum="100" Margin="10,5,0,0" Width="187" Height="12"/>
- </StackPanel>
- </Viewbox>
-
- <uc:FlowPanel ContentAlignment="Left" Orientation="Horizontal" HorizontalSpacing="10" VerticalSpacing="5" Margin="40,10,5,0">
- <TextBlock Style="{StaticResource TextDefault}" Text="{DynamicResource cmbox_lang_main}" Margin="0,5,0,0"/>
- <ComboBox Style="{StaticResource CustomComboBoxStyle}" Height="32" ItemsSource="{Binding Languages}" SelectedValue="{Binding SelectedLanguage, Mode=TwoWay}" SelectedValuePath="Code" DisplayMemberPath="Display"/>
- </uc:FlowPanel>
-
- <Border Background="{StaticResource Brush_Separator}" Height="1.2" Width="330" VerticalAlignment="Bottom" CornerRadius="10" Margin="0,10,0,0"/>
-
- <StackPanel Orientation="Vertical" Margin="0,12,0,0" Width="330">
-
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="8"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
-
- <Button Grid.Column="0" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding ExportConfigCommand}">
- <StackPanel Orientation="Horizontal">
- <Image>
- <Image.Style>
- <Style TargetType="{x:Type Image}">
- <Setter Property="Source" Value="{StaticResource Icon_Export}"/>
- </Style>
- </Image.Style>
- </Image>
- <TextBlock Text="{DynamicResource btn_export}" Margin="7,0,0,0" VerticalAlignment="Center"/>
- </StackPanel>
- </Button>
-
- <Button Grid.Column="2" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding ImportConfigCommand}">
- <StackPanel Orientation="Horizontal">
- <Image>
- <Image.Style>
- <Style TargetType="{x:Type Image}">
- <Setter Property="Source" Value="{StaticResource Icon_Import}"/>
- </Style>
- </Image.Style>
- </Image>
- <TextBlock Text="{DynamicResource btn_import}" Margin="7,0,0,0" VerticalAlignment="Center"/>
- </StackPanel>
- </Button>
- </Grid>
-
- <Button Margin="0,8,0,0" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding SelfRemovalCommand}">
- <StackPanel Orientation="Horizontal">
- <Image>
- <Image.Style>
- <Style TargetType="{x:Type Image}">
- <Setter Property="Source" Value="{StaticResource Icon_SelfRemoval}"/>
- </Style>
- </Image.Style>
- </Image>
- <TextBlock Text="{DynamicResource btn_selfremove}" Margin="7,0,0,0" VerticalAlignment="Center"/>
- </StackPanel>
- </Button>
-
- </StackPanel>
- </StackPanel>
- </Grid>
-
- <Grid Grid.Row="2" VerticalAlignment="Bottom" Margin="0,50,0,0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
-
- <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="20,0,0,10" HorizontalAlignment="Left">
- <Image x:Uid="git" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
- <Image.Style>
- <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
- <Setter Property="Source" Value="{StaticResource Icon_Git}"/>
- </Style>
- </Image.Style>
- </Image>
- <Image x:Uid="tg" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
- <Image.Style>
- <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
- <Setter Property="Source" Value="{StaticResource Icon_Telegram}"/>
- </Style>
- </Image.Style>
- </Image>
- <Image x:Uid="steam" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
- <Image.Style>
- <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
- <Setter Property="Source" Value="{StaticResource Icon_Steam}"/>
- </Style>
- </Image.Style>
- </Image>
- </StackPanel>
-
- <TextBlock Grid.Column="1" Style="{StaticResource TextInactivity}" FontFamily="{StaticResource Play}" FontSize="12" Foreground="{StaticResource Brush_Inactive}" Text="{Binding DisplayTweakVersion}" VerticalAlignment="Center" Margin="0,0,20,10" HorizontalAlignment="Right"/>
- </Grid>
-
- </Grid>
-
- </ScrollViewer>
- </Border>
-
<Border Background="{StaticResource Brush_ShadowOverlay}" Opacity="0.7" CornerRadius="10" Margin="10,15,0,50" IsHitTestVisible="False">
<Border.RenderTransform>
<TranslateTransform X="2" Y="4" />
@@ -323,7 +171,159 @@
</Grid>
- <Grid x:Name="UpdateBanner" Grid.Row="2" Panel.ZIndex="200" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,12,0,0" Visibility="Collapsed" Opacity="0" CacheMode="BitmapCache" d:CacheMode="{x:Null}">
+ <Border x:Name="SettingsPanel" Panel.ZIndex="10" Grid.Row="1" Width="400" HorizontalAlignment="Right" RenderTransformOrigin="1,0" Opacity="0.97" Background="{StaticResource Brush_Background}">
+ <Border.RenderTransform>
+ <TranslateTransform X="400"/>
+ </Border.RenderTransform>
+ <Border.OpacityMask>
+ <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
+ <GradientStop Color="Transparent" Offset="0.0"/>
+ <GradientStop Color="Black" Offset="0.03"/>
+ <GradientStop Color="Black" Offset="1.0"/>
+ </LinearGradientBrush>
+ </Border.OpacityMask>
+
+ <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
+ <Grid Width="400" Margin="0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="*"/>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+ <Grid Grid.Row="0">
+ <TextBlock FontFamily="{StaticResource Jura}" Text="{DynamicResource title_settings_main}" Foreground="{StaticResource Brush_Accent}" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,10,0,0">
+ <TextBlock.Effect>
+ <DropShadowEffect BlurRadius="20" ShadowDepth="1" Direction="-90" Color="{StaticResource Color_Shadow}" />
+ </TextBlock.Effect>
+ <TextBlock.CacheMode>
+ <BitmapCache RenderAtScale="2" EnableClearType="True"/>
+ </TextBlock.CacheMode>
+ </TextBlock>
+ <Border Background="{StaticResource Brush_Separator}" Height="1.2" Width="330" VerticalAlignment="Bottom" CornerRadius="10" Margin="0,50,0,0"/>
+ </Grid>
+
+ <Grid Grid.Row="1">
+ <StackPanel Orientation="Vertical">
+ <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
+ <uc:ToggleButton x:Name="BtnNotification" State="{Binding IsViewNotification}" TextResource="{DynamicResource btgl_noty_main}"/>
+ </Viewbox>
+
+ <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
+ <uc:ToggleButton x:Name="BtnUpdate" State="{Binding IsUpdateCheckRequired}" TextResource="{DynamicResource btgl_update_main}"/>
+ </Viewbox>
+
+ <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="23" Margin="40,15,10,0">
+ <uc:ToggleButton x:Name="BtnTopMost" State="{Binding IsTopMost}" TextResource="{DynamicResource btgl_toast_main}"/>
+ </Viewbox>
+
+ <Viewbox HorizontalAlignment="Left" Stretch="Uniform" StretchDirection="DownOnly" Height="45" Margin="40,10,10,0">
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Top">
+ <TextBlock Style="{StaticResource TextDefault}" Text="{DynamicResource slider_volume_main}"/>
+ <ToggleButton x:Name="BtnVolume" IsChecked="{Binding IsPlayingSound}" Width="20" Height="20" Margin="10,4,0,0" Style="{StaticResource TglVolume}"/>
+ <Slider x:Name="SliderVolume" Style="{StaticResource Percent_Slider}" Value="{Binding CurrentVolume}" IsSnapToTickEnabled="True" Minimum="1" Maximum="100" Margin="10,5,0,0" Width="187" Height="12"/>
+ </StackPanel>
+ </Viewbox>
+
+ <uc:FlowPanel ContentAlignment="Left" Orientation="Horizontal" HorizontalSpacing="10" VerticalSpacing="5" Margin="40,10,5,0">
+ <TextBlock Style="{StaticResource TextDefault}" Text="{DynamicResource cmbox_lang_main}" Margin="0,5,0,0"/>
+ <ComboBox Style="{StaticResource CustomComboBoxStyle}" Height="32" ItemsSource="{Binding Languages}" SelectedValue="{Binding SelectedLanguage, Mode=TwoWay}" SelectedValuePath="Code" DisplayMemberPath="Display"/>
+ </uc:FlowPanel>
+
+ <Border Background="{StaticResource Brush_Separator}" Height="1.2" Width="330" VerticalAlignment="Bottom" CornerRadius="10" Margin="0,10,0,0"/>
+
+ <StackPanel Orientation="Vertical" Margin="0,12,0,0" Width="330">
+
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="8"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+
+ <Button Grid.Column="0" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding ExportConfigCommand}">
+ <StackPanel Orientation="Horizontal">
+ <Image>
+ <Image.Style>
+ <Style TargetType="{x:Type Image}">
+ <Setter Property="Source" Value="{StaticResource Icon_Export}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ <TextBlock Text="{DynamicResource btn_export}" Margin="7,0,0,0" VerticalAlignment="Center"/>
+ </StackPanel>
+ </Button>
+
+ <Button Grid.Column="2" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding ImportConfigCommand}">
+ <StackPanel Orientation="Horizontal">
+ <Image>
+ <Image.Style>
+ <Style TargetType="{x:Type Image}">
+ <Setter Property="Source" Value="{StaticResource Icon_Import}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ <TextBlock Text="{DynamicResource btn_import}" Margin="7,0,0,0" VerticalAlignment="Center"/>
+ </StackPanel>
+ </Button>
+ </Grid>
+
+ <Button Margin="0,8,0,0" Style="{StaticResource ButtonContent}" Height="34" Command="{Binding SelfRemovalCommand}">
+ <StackPanel Orientation="Horizontal">
+ <Image>
+ <Image.Style>
+ <Style TargetType="{x:Type Image}">
+ <Setter Property="Source" Value="{StaticResource Icon_SelfRemoval}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ <TextBlock Text="{DynamicResource btn_selfremove}" Margin="7,0,0,0" VerticalAlignment="Center"/>
+ </StackPanel>
+ </Button>
+
+ </StackPanel>
+ </StackPanel>
+ </Grid>
+
+ <Grid Grid.Row="2" VerticalAlignment="Bottom" Margin="0,50,0,0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+
+ <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="20,0,0,10" HorizontalAlignment="Left">
+ <Image x:Uid="git" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
+ <Image.Style>
+ <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
+ <Setter Property="Source" Value="{StaticResource Icon_Git}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ <Image x:Uid="tg" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
+ <Image.Style>
+ <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
+ <Setter Property="Source" Value="{StaticResource Icon_Telegram}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ <Image x:Uid="steam" Width="31" Height="auto" Cursor="Hand" PreviewMouseLeftButtonUp="BtnContacts_PreviewMouseLeftButtonUp">
+ <Image.Style>
+ <Style TargetType="{x:Type Image}" BasedOn="{StaticResource ImageHover}">
+ <Setter Property="Source" Value="{StaticResource Icon_Steam}"/>
+ </Style>
+ </Image.Style>
+ </Image>
+ </StackPanel>
+
+ <TextBlock Grid.Column="1" Style="{StaticResource TextInactivity}" FontFamily="{StaticResource Play}" FontSize="12" Foreground="{StaticResource Brush_Inactive}" Text="{Binding DisplayTweakVersion}" VerticalAlignment="Center" Margin="0,0,20,10" HorizontalAlignment="Right"/>
+ </Grid>
+
+ </Grid>
+
+ </ScrollViewer>
+ </Border>
+
+ <Grid x:Name="UpdateBanner" Grid.Row="1" Panel.ZIndex="200" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,12,0,0" Visibility="Collapsed" Opacity="0" CacheMode="BitmapCache" d:CacheMode="{x:Null}">
<Grid.RenderTransform>
<TranslateTransform Y="-20"/>
</Grid.RenderTransform>
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index 1af910e8..d0506116 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -19,6 +19,7 @@ namespace GTweak.Windows
{
public partial class MainWindow : FluentWindow
{
+ private static readonly BitmapCache _bitmapCache = new BitmapCache { RenderAtScale = 1, EnableClearType = false };
private bool _ignoreMouseClick = false;
private RadioButton _activeBtnCache;
@@ -93,10 +94,14 @@ namespace GTweak.Windows
private void TglButtonSettings_Click(object sender, RoutedEventArgs e)
{
- SettingsPanel.CacheMode = new BitmapCache { RenderAtScale = 1 };
+ SettingsPanel.CacheMode = _bitmapCache;
+
if (SettingsPanel.RenderTransform is TranslateTransform transform)
{
- transform.BeginAnimation(TranslateTransform.XProperty, AnimationFactory.CreateIn(transform.X, TglButtonSettings.IsChecked.Value ? 0 : 400, 0.5, () => { SettingsPanel.CacheMode = null; }, useCubicEase: true));
+ Dispatcher.InvokeAsync(() =>
+ {
+ transform.BeginAnimation(TranslateTransform.XProperty, AnimationFactory.CreateIn(transform.X, TglButtonSettings.IsChecked == true ? 0 : 400, 0.5, () => { SettingsPanel.CacheMode = null; }, useCubicEase: true));
+ }, DispatcherPriority.Render);
}
}
@@ -196,10 +201,10 @@ namespace GTweak.Windows
await Task.Delay(500);
UpdateBanner.Visibility = Visibility.Visible;
- UpdateBanner.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.3));
+ UpdateBanner.BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.2));
if (UpdateBanner.RenderTransform is TranslateTransform transform)
{
- transform.BeginAnimation(TranslateTransform.YProperty, AnimationFactory.CreateIn(-20, 0, 0.3, () => { UpdateBanner.CacheMode = null; }, useCubicEase: true));
+ transform.BeginAnimation(TranslateTransform.YProperty, AnimationFactory.CreateIn(-20, 0, 0.3, useCubicEase: true));
}
}
}
diff --git a/.Source/GTweak/Windows/NotificationWindow.xaml.cs b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
index 54314ae3..313ce7e1 100644
--- a/.Source/GTweak/Windows/NotificationWindow.xaml.cs
+++ b/.Source/GTweak/Windows/NotificationWindow.xaml.cs
@@ -3,6 +3,8 @@ using System.Media;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Threading;
using GTweak.Animations;
using GTweak.Modules.Common;
using GTweak.Modules.Helpers;
@@ -13,6 +15,7 @@ namespace GTweak.Windows
{
public partial class NotificationWindow : FluentWindow
{
+ private static readonly BitmapCache _bitmapCache = new BitmapCache { RenderAtScale = 1, EnableClearType = false };
private NotificationManager.NoticeAction _requiredAction = default;
private TimerControlManager _timer = default;
private Rect primaryMonitorArea = SystemParameters.WorkArea;
@@ -38,12 +41,17 @@ namespace GTweak.Windows
{
if (GlobalOptions.IsPlayingSound)
{
- using SoundPlayer notificationSound = new SoundPlayer(Properties.Resources.Sound);
+ var notificationSound = new SoundPlayer(Properties.Resources.Sound);
notificationSound.Play();
}
- BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.2));
- BeginAnimation(LeftProperty, AnimationFactory.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.35, () => { CacheMode = null; }, useCubicEase: true));
+ CacheMode = _bitmapCache;
+
+ Dispatcher.InvokeAsync(() =>
+ {
+ BeginAnimation(OpacityProperty, AnimationFactory.CreateIn(0, 1, 0.2));
+ BeginAnimation(LeftProperty, AnimationFactory.CreateIn(primaryMonitorArea.Right + 10, primaryMonitorArea.Right - Width - 10, 0.35, () => { CacheMode = null; }, useCubicEase: true));
+ }, DispatcherPriority.Render);
_timer = new TimerControlManager(TimeSpan.FromSeconds(3), TimerControlManager.TimerMode.CountDown, null, () => { Close(); });
_timer.Start();