Skip to content

Portable Tool for an Ideal Windows Setup

upd description block to add parameter status output (#119 #54) & fix autoscroll smoothness & refactoring

Greedekseafa5473bbe1
diff --git a/.Source/GTweak/Assets/UserControls/Card.xaml.cs b/.Source/GTweak/Assets/UserControls/Card.xaml.cs
index 3f8e8921..cafe114e 100644
--- a/.Source/GTweak/Assets/UserControls/Card.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/Card.xaml.cs
@@ -9,6 +9,15 @@ namespace GTweak.Assets.UserControls
{
internal event EventHandler ClickButton, ClickButtonSecondary;
+ internal static readonly DependencyProperty IconStyleProperty =
+ DependencyProperty.Register(nameof(IconStyle), typeof(Style), typeof(Card), new PropertyMetadata(null, OnIconStyleChanged));
+
+ internal static readonly DependencyProperty TextProperty =
+ DependencyProperty.Register(nameof(TextBlock), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
+
+ internal static new readonly DependencyProperty ContentProperty =
+ DependencyProperty.Register(nameof(BtnContent), typeof(string), typeof(Button), new PropertyMetadata(string.Empty, (s, e) => { if (s is Button btn && e.NewValue is string str) { btn.Content = str; } }));
+
internal Style IconStyle { get => (Style)GetValue(IconStyleProperty); set => SetValue(IconStyleProperty, value); }
internal DynamicResourceExtension Title { set { if (value != null) { CardTitle?.SetResourceReference(TextBlock.TextProperty, new DynamicResourceExtensionConverter().ConvertToString(value.ResourceKey)); } } }
@@ -36,15 +45,6 @@ namespace GTweak.Assets.UserControls
}
}
- internal static readonly DependencyProperty IconStyleProperty =
- DependencyProperty.Register(nameof(IconStyle), typeof(Style), typeof(Card), new PropertyMetadata(null, OnIconStyleChanged));
-
- internal static readonly DependencyProperty TextProperty =
- DependencyProperty.Register(nameof(TextBlock), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
-
- internal static new readonly DependencyProperty ContentProperty =
- DependencyProperty.Register(nameof(BtnContent), typeof(string), typeof(Button), new PropertyMetadata(string.Empty, (s, e) => { if (s is Button btn && e.NewValue is string str) { btn.Content = str; } }));
-
private static void OnIconStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is Card card && card.CardIcon != null)
diff --git a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
index c6dbba3c..135fd741 100644
--- a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
+++ b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml
@@ -1,22 +1,78 @@
<UserControl x:Class="GTweak.Assets.UserControls.DescriptionBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:b="clr-namespace:GTweak.Utilities.Behaviors"
xmlns:local="clr-namespace:GTweak.Assets.UserControls"
mc:Ignorable="d" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None" SnapsToDevicePixels="True" UseLayoutRounding="True"
- d:DesignHeight="450" d:DesignWidth="800">
- <Grid Margin="10">
- <ScrollViewer x:Name="Scroller" b:ScrollFadeBehavior.EnableFade="True" Margin="6" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" ClipToBounds="True">
- <TextBlock x:Name="FunctionDescription" Style="{StaticResource Description}" Text="{Binding DefaultText, RelativeSource={RelativeSource AncestorType=local:DescriptionBlock}}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxWidth="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
- </ScrollViewer>
+ d:DesignHeight="100" d:DesignWidth="800">
+ <Grid Margin="10,0,10,5">
+ <Border CornerRadius="12" Background="Transparent" BorderThickness="1" BorderBrush="{StaticResource Brush_Background_ComboBox}">
+ <Grid Margin="15,12">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
- <Border Background="{StaticResource Brush_Separator}" Height="30" Width="1" HorizontalAlignment="Left" VerticalAlignment="Top" CornerRadius="0,0,15,15" />
- <Border Background="{StaticResource Brush_Separator}" Height="1" Width="30" HorizontalAlignment="Left" VerticalAlignment="Top" CornerRadius="0,15,15,0" />
+ <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="0,0,10,0" VerticalAlignment="Top" Opacity="0.8">
+ <TextBlock Text=">" FontFamily="{StaticResource Jura}" FontSize="14" FontWeight="Bold" Foreground="{StaticResource Brush_Accent}"/>
+ <TextBlock x:Name="Caret" Text="_" FontFamily="{StaticResource Jura}" FontSize="14" FontWeight="Bold" Foreground="{StaticResource Brush_Accent}"/>
+ </StackPanel>
- <Border Background="{StaticResource Brush_Separator}" Height="30" Width="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" CornerRadius="15,15,0,0" />
- <Border Background="{StaticResource Brush_Separator}" Height="1" Width="30" HorizontalAlignment="Right" VerticalAlignment="Bottom" CornerRadius="15,0,0,15" />
+ <ScrollViewer x:Name="Scroller" Grid.Column="1" b:ScrollFadeBehavior.EnableFade="True" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" ClipToBounds="True">
+ <TextBlock x:Name="FunctionDescription" Style="{StaticResource Description}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" VerticalAlignment="Top" TextAlignment="Center" LineHeight="18" MaxWidth="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=UserControl}}"/>
+ </ScrollViewer>
+
+ <StackPanel x:Name="StatusPanel" Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Bottom" Margin="15,0,0,0" Opacity="0">
+ <Ellipse Width="8" Height="8" VerticalAlignment="Center" Margin="0,0,6,0">
+ <Ellipse.CacheMode>
+ <BitmapCache RenderAtScale="2" />
+ </Ellipse.CacheMode>
+ <Ellipse.Style>
+ <Style TargetType="Ellipse">
+ <Setter Property="Fill" Value="{StaticResource Brush_Danger_Hover}"/>
+ <Setter Property="Effect">
+ <Setter.Value>
+ <DropShadowEffect Color="{StaticResource Color_Shadow_Danger}" BlurRadius="6" ShadowDepth="0" Opacity="0.8"/>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding TargetState, RelativeSource={RelativeSource AncestorType=local:DescriptionBlock}}" Value="True">
+ <Setter Property="Fill" Value="{StaticResource Brush_Accent}"/>
+ <Setter Property="Effect">
+ <Setter.Value>
+ <DropShadowEffect Color="{StaticResource Color_Shadow}" BlurRadius="6" ShadowDepth="0" Opacity="0.8"/>
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Ellipse.Style>
+ </Ellipse>
+
+ <Grid VerticalAlignment="Center">
+ <TextBlock Text="{DynamicResource status_disabled}" FontSize="12" FontFamily="{StaticResource Jura}" Visibility="Hidden"/>
+ <TextBlock Text="{DynamicResource status_active}" FontSize="12" FontFamily="{StaticResource Jura}" Visibility="Hidden"/>
+ <TextBlock FontSize="12" FontFamily="{StaticResource Jura}" HorizontalAlignment="Left">
+ <TextBlock.Style>
+ <Style TargetType="TextBlock">
+ <Setter Property="Text" Value="{DynamicResource status_disabled}"/>
+ <Setter Property="Foreground" Value="{StaticResource Brush_Danger_Hover}"/>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding TargetState, RelativeSource={RelativeSource AncestorType=local:DescriptionBlock}}" Value="True">
+ <Setter Property="Text" Value="{DynamicResource status_active}"/>
+ <Setter Property="Foreground" Value="{StaticResource Brush_Accent}"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </TextBlock.Style>
+ </TextBlock>
+ </Grid>
+ </StackPanel>
+ </Grid>
+ </Border>
</Grid>
-
-</UserControl>
+
+</UserControl>
\ No newline at end of file
diff --git a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
index 5e055b9a..ed5b6274 100644
--- a/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/DescriptionBlock.xaml.cs
@@ -4,8 +4,9 @@ using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
-using System.Windows.Controls;
+using System.Windows.Media.Animation;
using GTweak.Utilities.Animation;
+using GTweak.Utilities.Behaviors;
using GTweak.Utilities.Controls;
namespace GTweak.Assets.UserControls
@@ -13,6 +14,13 @@ namespace GTweak.Assets.UserControls
public partial class DescriptionBlock
{
private CancellationTokenSource _scrollCts;
+ private string _currentDefaultText = string.Empty;
+
+ internal static readonly DependencyProperty DefaultTextProperty =
+ DependencyProperty.Register("DefaultText", typeof(string), typeof(DescriptionBlock), new UIPropertyMetadata(string.Empty));
+
+ internal static readonly DependencyProperty TargetStateProperty =
+ DependencyProperty.Register("TargetState", typeof(bool?), typeof(DescriptionBlock), new UIPropertyMetadata(null));
internal string DefaultText
{
@@ -20,15 +28,19 @@ namespace GTweak.Assets.UserControls
set => SetValue(DefaultTextProperty, value);
}
- public static readonly DependencyProperty DefaultTextProperty =
- DependencyProperty.Register("DefaultText", typeof(string), typeof(DescriptionBlock), new UIPropertyMetadata(string.Empty));
+ internal bool? TargetState
+ {
+ get => (bool?)GetValue(TargetStateProperty);
+ set => SetValue(TargetStateProperty, value);
+ }
internal string Text
{
- get => FunctionDescription?.Text ?? string.Empty;
+ get => _currentDefaultText;
set
{
string safeValue = value ?? string.Empty;
+ _currentDefaultText = safeValue;
_scrollCts?.Cancel();
@@ -40,10 +52,18 @@ namespace GTweak.Assets.UserControls
Scroller.ScrollToVerticalOffset(0);
Scroller.UpdateLayout();
- TypewriterAnimation.Create(safeValue, FunctionDescription, safeValue.Length <= 50 ? TimeSpan.FromMilliseconds(200) : safeValue.Length <= 200 ? TimeSpan.FromMilliseconds(400) : TimeSpan.FromMilliseconds(550));
+ StatusPanel.BeginAnimation(OpacityProperty, null);
+ StatusPanel.Opacity = 0;
+
+ TimeSpan duration = safeValue.Length <= 50 ? TimeSpan.FromMilliseconds(200) : safeValue.Length <= 200 ? TimeSpan.FromMilliseconds(400) : TimeSpan.FromMilliseconds(550);
+
+ Caret.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(1.0, 0.0, 0.3, reverse: true));
+
+ FunctionDescription.Text = string.Empty;
+ TypewriterAnimation.Create(safeValue, FunctionDescription, duration);
_scrollCts = new CancellationTokenSource();
- _ = StartAutoScrollAsync(safeValue, _scrollCts.Token);
+ _ = HandleStatusAndScrollAsync(safeValue, duration, _scrollCts.Token);
}
}
}
@@ -59,6 +79,7 @@ namespace GTweak.Assets.UserControls
if (FunctionDescription != null)
{
UpdateFlowDirection();
+ _currentDefaultText = DefaultText;
TypewriterAnimation.Create(DefaultText, FunctionDescription, TimeSpan.FromMilliseconds(300));
}
};
@@ -76,6 +97,8 @@ namespace GTweak.Assets.UserControls
if (FunctionDescription != null)
{
UpdateFlowDirection();
+ _currentDefaultText = DefaultText;
+ FunctionDescription.Text = string.Empty;
TypewriterAnimation.Create(DefaultText, FunctionDescription, TimeSpan.Zero);
}
}
@@ -92,54 +115,65 @@ namespace GTweak.Assets.UserControls
}
}
- private async Task StartAutoScrollAsync(string text, CancellationToken token)
+ private async Task HandleStatusAndScrollAsync(string text, TimeSpan typewriterDuration, CancellationToken token)
{
- await Task.Delay(2000, token);
+ await Task.Delay(typewriterDuration, token);
- if (text != DefaultText && !token.IsCancellationRequested)
+ if (!token.IsCancellationRequested)
{
await Dispatcher.InvokeAsync(() =>
{
- if (FunctionDescription != null && Scroller != null)
+ if (!token.IsCancellationRequested)
{
- FunctionDescription.UpdateLayout();
- Scroller.UpdateLayout();
- Scroller.ScrollToVerticalOffset(0);
+ Caret.BeginAnimation(OpacityProperty, null);
+ Caret.Opacity = 1;
+
+ if (TargetState != null && text != DefaultText)
+ {
+ StatusPanel.BeginAnimation(OpacityProperty, FactoryAnimation.CreateIn(0.0, 1.0, 0.3));
+ }
}
});
- if (Scroller != null && !token.IsCancellationRequested)
+ await Task.Delay(1500, token);
+
+ if (text != DefaultText && !token.IsCancellationRequested)
{
- double maxOffset = Scroller.ScrollableHeight;
- if (maxOffset > 0)
+ await Dispatcher.InvokeAsync(() =>
{
- double durationSeconds = Math.Max(2.0, maxOffset / 20);
-
- await Dispatcher.InvokeAsync(() => { Scroller?.BeginAnimation(ScrollViewerBehavior.VerticalOffsetProperty, FactoryAnimation.CreateIn(0, maxOffset, durationSeconds, useCubicEase: true)); });
-
- try { await Task.Delay(TimeSpan.FromSeconds(durationSeconds), token); }
- catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ if (FunctionDescription != null && Scroller != null)
+ {
+ FunctionDescription.UpdateLayout();
+ Scroller.UpdateLayout();
+ }
+ });
+
+ if (Scroller != null && !token.IsCancellationRequested)
+ {
+ double maxOffset = Scroller.ScrollableHeight;
+ if (maxOffset > 0)
+ {
+ double durationSeconds = Math.Min(6.0, (maxOffset / 20.0) + 0.8);
+
+ await Dispatcher.InvokeAsync(() =>
+ {
+ DoubleAnimation inertiaAnimation = new DoubleAnimation(0, maxOffset, TimeSpan.FromSeconds(durationSeconds))
+ {
+ EasingFunction = new QuarticEase { EasingMode = EasingMode.EaseOut }
+ };
+
+ Scroller?.BeginAnimation(ScrollViewerBehavior.VerticalOffsetProperty, inertiaAnimation);
+ });
+
+ try
+ {
+ await Task.Delay(TimeSpan.FromSeconds(durationSeconds), token);
+ }
+ catch (Exception ex) { ErrorLogging.LogDebug(ex); }
+ }
}
}
}
}
-
- private static class ScrollViewerBehavior
- {
- internal static readonly DependencyProperty VerticalOffsetProperty =
- DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollViewerBehavior), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnVerticalOffsetChanged));
-
- internal static double GetVerticalOffset(ScrollViewer viewer) => (double)(viewer?.GetValue(VerticalOffsetProperty) ?? 0.0);
-
- internal static void SetVerticalOffset(ScrollViewer viewer, double value) => viewer?.SetValue(VerticalOffsetProperty, value);
-
- private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (d is ScrollViewer viewer && e.NewValue is double offset)
- {
- viewer.ScrollToVerticalOffset(offset);
- }
- }
- }
}
}
\ No newline at end of file
diff --git a/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs b/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
index ed470079..976b8297 100644
--- a/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/FileCard.xaml.cs
@@ -8,33 +8,37 @@ namespace GTweak.Assets.UserControls
{
public partial class FileCard
{
- public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(FileCard), new PropertyMetadata(string.Empty));
+ internal static readonly DependencyProperty FileNameProperty =
+ DependencyProperty.Register(nameof(FileName), typeof(string), typeof(FileCard), new PropertyMetadata(string.Empty));
- public static readonly DependencyProperty IconSourceProperty = DependencyProperty.Register(nameof(IconSource), typeof(ImageSource), typeof(FileCard), new PropertyMetadata(null));
+ internal static readonly DependencyProperty IconSourceProperty =
+ DependencyProperty.Register(nameof(IconSource), typeof(ImageSource), typeof(FileCard), new PropertyMetadata(null));
- public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(FileCard), new PropertyMetadata(null));
+ internal static readonly DependencyProperty CommandProperty =
+ DependencyProperty.Register(nameof(Command), typeof(ICommand), typeof(FileCard), new PropertyMetadata(null));
- public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(nameof(CommandParameter), typeof(object), typeof(FileCard), new PropertyMetadata(null));
+ internal static readonly DependencyProperty CommandParameterProperty =
+ DependencyProperty.Register(nameof(CommandParameter), typeof(object), typeof(FileCard), new PropertyMetadata(null));
- public string FileName
+ internal string FileName
{
get => (string)GetValue(FileNameProperty);
set => SetValue(FileNameProperty, value);
}
- public ImageSource IconSource
+ internal ImageSource IconSource
{
get => (ImageSource)GetValue(IconSourceProperty);
set => SetValue(IconSourceProperty, value);
}
- public ICommand Command
+ internal ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
- public object CommandParameter
+ internal object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
diff --git a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
index 921d01ba..3911f2d8 100644
--- a/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ToggleButton.xaml.cs
@@ -18,10 +18,10 @@ namespace GTweak.Assets.UserControls
EventManager.RegisterRoutedEvent(nameof(ChangedState), RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(ToggleButton));
private static readonly DependencyProperty StateProperty =
- DependencyProperty.Register(nameof(State), typeof(bool), typeof(ToggleButton), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnStateChanged));
+ DependencyProperty.Register(nameof(State), typeof(bool), typeof(ToggleButton), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnStateChanged));
private static readonly DependencyProperty TextProperty =
- DependencyProperty.Register(nameof(TextResource), typeof(string), typeof(ToggleButton), new PropertyMetadata("", (s, e) => { if (s is ToggleButton btn && btn.ToggleText != null) { btn.ToggleText.Text = e.NewValue as string; } }));
+ DependencyProperty.Register(nameof(TextResource), typeof(string), typeof(ToggleButton), new PropertyMetadata("", (s, e) => { if (s is ToggleButton btn && btn.ToggleText != null) { btn.ToggleText.Text = e.NewValue as string; } }));
private static readonly DependencyProperty DescriptionProperty =
DependencyProperty.Register(nameof(Description), typeof(object), typeof(ToggleButton), new PropertyMetadata(null));
diff --git a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml.cs b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml.cs
index 28f79418..719b75ff 100644
--- a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml.cs
@@ -8,75 +8,91 @@ namespace GTweak.Assets.UserControls
{
public partial class ToolsetCard : UserControl
{
- public static readonly DependencyProperty AppIconProperty = DependencyProperty.Register(nameof(AppIcon), typeof(ImageSource), typeof(ToolsetCard), new PropertyMetadata(null));
- public static readonly DependencyProperty AppNameProperty = DependencyProperty.Register(nameof(AppName), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
+ internal static readonly DependencyProperty AppIconProperty =
+ DependencyProperty.Register(nameof(AppIcon), typeof(ImageSource), typeof(ToolsetCard), new PropertyMetadata(null));
- public static readonly DependencyProperty AuthorIconProperty = DependencyProperty.Register(nameof(AuthorIcon), typeof(ImageSource), typeof(ToolsetCard), new PropertyMetadata(null));
- public static readonly DependencyProperty AuthorNameProperty = DependencyProperty.Register(nameof(AuthorName), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
- public static readonly DependencyProperty SourceUrlProperty = DependencyProperty.Register(nameof(SourceUrl), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
+ internal static readonly DependencyProperty AppNameProperty =
+ DependencyProperty.Register(nameof(AppName), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
- public static readonly DependencyProperty DownloadCommandProperty = DependencyProperty.Register(nameof(DownloadCommand), typeof(ICommand), typeof(ToolsetCard), new PropertyMetadata(null));
- public static readonly DependencyProperty CancelCommandProperty = DependencyProperty.Register(nameof(CancelCommand), typeof(ICommand), typeof(ToolsetCard), new PropertyMetadata(null));
+ internal static readonly DependencyProperty AuthorIconProperty =
+ DependencyProperty.Register(nameof(AuthorIcon), typeof(ImageSource), typeof(ToolsetCard), new PropertyMetadata(null));
- public static readonly DependencyProperty IsDownloadingProperty = DependencyProperty.Register(nameof(IsDownloading), typeof(bool), typeof(ToolsetCard), new PropertyMetadata(false));
- public static readonly DependencyProperty ProgressProperty = DependencyProperty.Register(nameof(Progress), typeof(double), typeof(ToolsetCard), new PropertyMetadata(0.0));
- public static readonly DependencyProperty IsSquareIconProperty = DependencyProperty.Register(nameof(IsSquareIcon), typeof(bool), typeof(ToolsetCard), new PropertyMetadata(false));
+ internal static readonly DependencyProperty AuthorNameProperty =
+ DependencyProperty.Register(nameof(AuthorName), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
- public ImageSource AppIcon
+ internal static readonly DependencyProperty SourceUrlProperty =
+ DependencyProperty.Register(nameof(SourceUrl), typeof(string), typeof(ToolsetCard), new PropertyMetadata(string.Empty));
+
+ internal static readonly DependencyProperty DownloadCommandProperty =
+ DependencyProperty.Register(nameof(DownloadCommand), typeof(ICommand), typeof(ToolsetCard), new PropertyMetadata(null));
+
+ internal static readonly DependencyProperty CancelCommandProperty =
+ DependencyProperty.Register(nameof(CancelCommand), typeof(ICommand), typeof(ToolsetCard), new PropertyMetadata(null));
+
+ internal static readonly DependencyProperty IsDownloadingProperty =
+ DependencyProperty.Register(nameof(IsDownloading), typeof(bool), typeof(ToolsetCard), new PropertyMetadata(false));
+
+ internal static readonly DependencyProperty ProgressProperty =
+ DependencyProperty.Register(nameof(Progress), typeof(double), typeof(ToolsetCard), new PropertyMetadata(0.0));
+
+ internal static readonly DependencyProperty IsSquareIconProperty =
+ DependencyProperty.Register(nameof(IsSquareIcon), typeof(bool), typeof(ToolsetCard), new PropertyMetadata(false));
+
+ internal ImageSource AppIcon
{
get => (ImageSource)GetValue(AppIconProperty);
set => SetValue(AppIconProperty, value);
}
- public string AppName
+ internal string AppName
{
get => (string)GetValue(AppNameProperty);
set => SetValue(AppNameProperty, value);
}
- public ImageSource AuthorIcon
+ internal ImageSource AuthorIcon
{
get => (ImageSource)GetValue(AuthorIconProperty);
set => SetValue(AuthorIconProperty, value);
}
- public string AuthorName
+ internal string AuthorName
{
get => (string)GetValue(AuthorNameProperty);
set => SetValue(AuthorNameProperty, value);
}
- public string SourceUrl
+ internal string SourceUrl
{
get => (string)GetValue(SourceUrlProperty);
set => SetValue(SourceUrlProperty, value);
}
- public ICommand DownloadCommand
+ internal ICommand DownloadCommand
{
get => (ICommand)GetValue(DownloadCommandProperty);
set => SetValue(DownloadCommandProperty, value);
}
- public ICommand CancelCommand
+ internal ICommand CancelCommand
{
get => (ICommand)GetValue(CancelCommandProperty);
set => SetValue(CancelCommandProperty, value);
}
- public bool IsDownloading
+ internal bool IsDownloading
{
get => (bool)GetValue(IsDownloadingProperty);
set => SetValue(IsDownloadingProperty, value);
}
- public double Progress
+ internal double Progress
{
get => (double)GetValue(ProgressProperty);
set => SetValue(ProgressProperty, value);
}
- public bool IsSquareIcon
+ internal bool IsSquareIcon
{
get => (bool)GetValue(IsSquareIconProperty);
set => SetValue(IsSquareIconProperty, value);
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 1f425df0..7e904ab4 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -208,6 +208,7 @@
<Compile Include="Core\ViewModel\ToolsetViewModel.cs" />
<Compile Include="Utilities\Animation\BlurAnimation.cs" />
<Compile Include="Utilities\Behaviors\ScrollFadeBehavior.cs" />
+ <Compile Include="Utilities\Behaviors\ScrollViewerBehavior.cs" />
<Compile Include="Utilities\Behaviors\TextBoxClearBehavior.cs" />
<Compile Include="Utilities\Configuration\IconExtractProvider.cs" />
<Compile Include="Utilities\Configuration\NetworkProvider.cs" />
diff --git a/.Source/GTweak/Languages/en/Localize.xaml b/.Source/GTweak/Languages/en/Localize.xaml
index 0096d244..de044d7e 100644
--- a/.Source/GTweak/Languages/en/Localize.xaml
+++ b/.Source/GTweak/Languages/en/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Hover your mouse over the icon of any application to see its name</v:String>
<v:String x:Key="btn_default">Default</v:String>
<v:String x:Key="btn_change">Change</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Loading</v:String>
diff --git a/.Source/GTweak/Languages/fr/Localize.xaml b/.Source/GTweak/Languages/fr/Localize.xaml
index 4e04858f..e9ffdbfd 100644
--- a/.Source/GTweak/Languages/fr/Localize.xaml
+++ b/.Source/GTweak/Languages/fr/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Survolez l'icône d'une application pour voir son nom</v:String>
<v:String x:Key="btn_default">Par défaut</v:String>
<v:String x:Key="btn_change">Modifier</v:String>
+
+ <v:String x:Key="status_active">ACTIF</v:String>
+ <v:String x:Key="status_disabled">DÉSACTIVÉ</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Chargement</v:String>
diff --git a/.Source/GTweak/Languages/he/Localize.xaml b/.Source/GTweak/Languages/he/Localize.xaml
index 7955c3e2..583b5571 100644
--- a/.Source/GTweak/Languages/he/Localize.xaml
+++ b/.Source/GTweak/Languages/he/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">העבר את העכבר מעל הסמל של אפליקציה כלשהי כדי לראות את שמה</v:String>
<v:String x:Key="btn_default">ברירת מחדל</v:String>
<v:String x:Key="btn_change">שינוי</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">טעינה</v:String>
diff --git a/.Source/GTweak/Languages/hu/Localize.xaml b/.Source/GTweak/Languages/hu/Localize.xaml
index d77af958..d43014de 100644
--- a/.Source/GTweak/Languages/hu/Localize.xaml
+++ b/.Source/GTweak/Languages/hu/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Vigye az egeret bármely alkalmazás ikonja fölé a nevének megtekintéséhez</v:String>
<v:String x:Key="btn_default">Alapértelmezett</v:String>
<v:String x:Key="btn_change">Módosítás</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Betöltés</v:String>
diff --git a/.Source/GTweak/Languages/it/Localize.xaml b/.Source/GTweak/Languages/it/Localize.xaml
index 3ac72731..82e78b4f 100644
--- a/.Source/GTweak/Languages/it/Localize.xaml
+++ b/.Source/GTweak/Languages/it/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Passa il mouse sull'icona di un'applicazione per vedere il suo nome</v:String>
<v:String x:Key="btn_default">Predefinito</v:String>
<v:String x:Key="btn_change">Modifica</v:String>
+
+ <v:String x:Key="status_active">ATTIVO</v:String>
+ <v:String x:Key="status_disabled">DISATTIVATO</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Caricamento</v:String>
diff --git a/.Source/GTweak/Languages/ko/Localize.xaml b/.Source/GTweak/Languages/ko/Localize.xaml
index ad40a72b..4f01a949 100644
--- a/.Source/GTweak/Languages/ko/Localize.xaml
+++ b/.Source/GTweak/Languages/ko/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">응용 프로그램의 아이콘 위에 마우스를 가져가면 이름을 확인할 수 있습니다</v:String>
<v:String x:Key="btn_default">기본값</v:String>
<v:String x:Key="btn_change">변경</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">로드 중</v:String>
diff --git a/.Source/GTweak/Languages/pl/Localize.xaml b/.Source/GTweak/Languages/pl/Localize.xaml
index 6e04c8c1..0000d2bd 100644
--- a/.Source/GTweak/Languages/pl/Localize.xaml
+++ b/.Source/GTweak/Languages/pl/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Najedź kursorem myszy na ikonę dowolnej aplikacji, aby zobaczyć jej nazwę</v:String>
<v:String x:Key="btn_default">Domyślne</v:String>
<v:String x:Key="btn_change">Zmień</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Ładowanie</v:String>
diff --git a/.Source/GTweak/Languages/pt-BR/Localize.xaml b/.Source/GTweak/Languages/pt-BR/Localize.xaml
index 7fdb403b..fe2b475e 100644
--- a/.Source/GTweak/Languages/pt-BR/Localize.xaml
+++ b/.Source/GTweak/Languages/pt-BR/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Passe o mouse sobre o ícone de qualquer aplicativo para ver seu nome</v:String>
<v:String x:Key="btn_default">Padrão</v:String>
<v:String x:Key="btn_change">Alterar</v:String>
+
+ <v:String x:Key="status_active">ATIVO</v:String>
+ <v:String x:Key="status_disabled">DESATIVADO</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Carregando</v:String>
diff --git a/.Source/GTweak/Languages/ru/Localize.xaml b/.Source/GTweak/Languages/ru/Localize.xaml
index a9398c58..73849108 100644
--- a/.Source/GTweak/Languages/ru/Localize.xaml
+++ b/.Source/GTweak/Languages/ru/Localize.xaml
@@ -7,6 +7,9 @@
<v:String x:Key="btn_default">По умолчанию</v:String>
<v:String x:Key="btn_change">Изменить</v:String>
+ <v:String x:Key="status_active">АКТИВЕН</v:String>
+ <v:String x:Key="status_disabled">ОТКЛЮЧЁН</v:String>
+
<!--#region Load Window -->
<v:String x:Key="title_load">Загрузка</v:String>
<v:String x:Key="step1_load">Подготовка среды</v:String>
diff --git a/.Source/GTweak/Languages/sl-SI/Localize.xaml b/.Source/GTweak/Languages/sl-SI/Localize.xaml
index 1a4d680e..cbad01cd 100644
--- a/.Source/GTweak/Languages/sl-SI/Localize.xaml
+++ b/.Source/GTweak/Languages/sl-SI/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Premaknite miško nad ikono poljubne aplikacije, da vidite njeno ime</v:String>
<v:String x:Key="btn_default">Privzeto</v:String>
<v:String x:Key="btn_change">Spremeni</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Nalaganje</v:String>
diff --git a/.Source/GTweak/Languages/th/Localize.xaml b/.Source/GTweak/Languages/th/Localize.xaml
index 1bb801c1..98a3f621 100644
--- a/.Source/GTweak/Languages/th/Localize.xaml
+++ b/.Source/GTweak/Languages/th/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">เลื่อนเมาส์ไปวางเหนือไอคอนของแอปพลิเคชันใดๆ เพื่อดูชื่อของแอปพลิเคชันนั้น</v:String>
<v:String x:Key="btn_default">ค่าเริ่มต้น</v:String>
<v:String x:Key="btn_change">เปลี่ยน</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">กำลังโหลด</v:String>
diff --git a/.Source/GTweak/Languages/tr/Localize.xaml b/.Source/GTweak/Languages/tr/Localize.xaml
index 475e1091..42df966c 100644
--- a/.Source/GTweak/Languages/tr/Localize.xaml
+++ b/.Source/GTweak/Languages/tr/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Adını görmek için farenizi herhangi bir uygulamanın simgesi üzerine getirin</v:String>
<v:String x:Key="btn_default">Varsayılan</v:String>
<v:String x:Key="btn_change">Değiştir</v:String>
+
+ <v:String x:Key="status_active">ACTIVE</v:String>
+ <v:String x:Key="status_disabled">DISABLED</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Yükleniyor</v:String>
diff --git a/.Source/GTweak/Languages/uk/Localize.xaml b/.Source/GTweak/Languages/uk/Localize.xaml
index 9e284a98..b1a48645 100644
--- a/.Source/GTweak/Languages/uk/Localize.xaml
+++ b/.Source/GTweak/Languages/uk/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">Наведіть вказівник миші на піктограму будь-якого додатку, щоб отримати його назву</v:String>
<v:String x:Key="btn_default">За замовчуванням</v:String>
<v:String x:Key="btn_change">Змінити</v:String>
+
+ <v:String x:Key="status_active">АКТИВНИЙ</v:String>
+ <v:String x:Key="status_disabled">ВИМКНЕНЙ</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">Завантаження</v:String>
diff --git a/.Source/GTweak/Languages/zh-CN/Localize.xaml b/.Source/GTweak/Languages/zh-CN/Localize.xaml
index eb858db3..ebed7a76 100644
--- a/.Source/GTweak/Languages/zh-CN/Localize.xaml
+++ b/.Source/GTweak/Languages/zh-CN/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">将鼠标悬停在任何应用程序的图标上,即可查看其名称</v:String>
<v:String x:Key="btn_default">默认</v:String>
<v:String x:Key="btn_change">更改</v:String>
+
+ <v:String x:Key="status_active">已启用</v:String>
+ <v:String x:Key="status_disabled">已禁用</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">载入中</v:String>
diff --git a/.Source/GTweak/Languages/zh-TW/Localize.xaml b/.Source/GTweak/Languages/zh-TW/Localize.xaml
index 65c03f51..ef483798 100644
--- a/.Source/GTweak/Languages/zh-TW/Localize.xaml
+++ b/.Source/GTweak/Languages/zh-TW/Localize.xaml
@@ -6,6 +6,9 @@
<v:String x:Key="defaultDescriptionApp">將滑鼠懸停在任何應用程式的圖示上,即可查看其名稱</v:String>
<v:String x:Key="btn_default">預設</v:String>
<v:String x:Key="btn_change">變更</v:String>
+
+ <v:String x:Key="status_active">已啟用</v:String>
+ <v:String x:Key="status_disabled">已禁用</v:String>
<!--#region Load Window -->
<v:String x:Key="title_load">載入中</v:String>
diff --git a/.Source/GTweak/Styles/Buttons/Buttons.xaml b/.Source/GTweak/Styles/Buttons/Buttons.xaml
index 8e839db2..8b257b92 100644
--- a/.Source/GTweak/Styles/Buttons/Buttons.xaml
+++ b/.Source/GTweak/Styles/Buttons/Buttons.xaml
@@ -98,7 +98,7 @@
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="Icon" Property="Background" Value="{StaticResource Brush_CloseBtn_Hover}"/>
+ <Setter TargetName="Icon" Property="Background" Value="{StaticResource Brush_Danger_Hover}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="BackgroundBorder" Property="Background" Value="{StaticResource Brush_TitleBtnBG_Pressed}"/>
diff --git a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
index 5a7da0d6..a20b8fe6 100644
--- a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
@@ -3,6 +3,7 @@
<Color x:Key="Color_Accent">#7BFFB5</Color>
<Color x:Key="Color_Shadow">#1AFF7E</Color>
+ <Color x:Key="Color_Shadow_Danger">#FF1A3E</Color>
<Color x:Key="Color_Separator">#434544</Color>
<SolidColorBrush x:Key="Brush_Background" Color="#FF1E1E1E"/>
@@ -14,7 +15,7 @@
<SolidColorBrush x:Key="Brush_TextBlock_Inactivity" Color="#DFDFDF"/>
- <SolidColorBrush x:Key="Brush_CloseBtn_Hover" Color="#DE6E62"/>
+ <SolidColorBrush x:Key="Brush_Danger_Hover" Color="#DE6E62"/>
<SolidColorBrush x:Key="Brush_TitleBtnBG_Pressed" Color="#FF333534"/>
<SolidColorBrush x:Key="Brush_BtnBG_Navigation" Color="#2C3932"/>
diff --git a/.Source/GTweak/Styles/Themes/Light/Colors.xaml b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
index 60d6d493..350e4ef3 100644
--- a/.Source/GTweak/Styles/Themes/Light/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
@@ -3,6 +3,7 @@
<Color x:Key="Color_Accent">#00A15A</Color>
<Color x:Key="Color_Shadow">#007A40</Color>
+ <Color x:Key="Color_Shadow_Danger">#C42040</Color>
<Color x:Key="Color_Separator">#C8C8C8</Color>
<SolidColorBrush x:Key="Brush_Background" Color="#FFF3F3F3"/>
@@ -14,7 +15,7 @@
<SolidColorBrush x:Key="Brush_TextBlock_Inactivity" Color="#404040"/>
- <SolidColorBrush x:Key="Brush_CloseBtn_Hover" Color="#C43C2E"/>
+ <SolidColorBrush x:Key="Brush_Danger_Hover" Color="#C43C2E"/>
<SolidColorBrush x:Key="Brush_TitleBtnBG_Pressed" Color="#FFC8C8C8"/>
<SolidColorBrush x:Key="Brush_BtnBG_Navigation" Color="#D4F3E6"/>
diff --git a/.Source/GTweak/Utilities/Behaviors/ScrollViewerBehavior.cs b/.Source/GTweak/Utilities/Behaviors/ScrollViewerBehavior.cs
new file mode 100644
index 00000000..f7f6362c
--- /dev/null
+++ b/.Source/GTweak/Utilities/Behaviors/ScrollViewerBehavior.cs
@@ -0,0 +1,22 @@
+using System.Windows;
+using System.Windows.Controls;
+
+namespace GTweak.Utilities.Behaviors
+{
+ internal static class ScrollViewerBehavior
+ {
+ internal static readonly DependencyProperty VerticalOffsetProperty =
+ DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollViewerBehavior), new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnVerticalOffsetChanged));
+
+ internal static double GetVerticalOffset(ScrollViewer viewer) => (double)(viewer?.GetValue(VerticalOffsetProperty) ?? 0.0);
+ internal static void SetVerticalOffset(ScrollViewer viewer, double value) => viewer?.SetValue(VerticalOffsetProperty, value);
+
+ private static void OnVerticalOffsetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is ScrollViewer viewer && e.NewValue is double offset)
+ {
+ viewer.ScrollToVerticalOffset(offset);
+ }
+ }
+ }
+}
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 1b7d62d5..647152ba 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -19,26 +19,31 @@ namespace GTweak.View
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
{
- string description = ((ToggleButton)sender!).Description?.ToString() ?? string.Empty;
-
- if (DescBlock.Text != description)
+ if (sender is ToggleButton tglButton && DescBlock.Text != tglButton.Description?.ToString())
{
- DescBlock.Text = description;
+ DescBlock.Text = tglButton.Description?.ToString() ?? string.Empty;
+ DescBlock.TargetState = tglButton.State;
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e)
+ {
+ DescBlock.Text = DescBlock.DefaultText;
+ DescBlock.TargetState = null;
+ }
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
- ToggleButton toggleButton = (ToggleButton)sender;
+ ToggleButton tglButton = (ToggleButton)sender;
+
+ DescBlock.TargetState = tglButton.State;
- _confTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
+ _confTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
- if (NotificationManager.ConfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))
+ if (NotificationManager.ConfActions.TryGetValue(tglButton.Name, out var action))
{
NotificationManager.Show().WithDelay(300).Perform(action);
}
}
}
-}
+}
\ No newline at end of file
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index d9359335..dddf1b5f 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -22,26 +22,31 @@ namespace GTweak.View
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
{
string description = string.Empty;
+ bool? state = null;
switch (sender)
{
case StackPanel panel:
description = panel.ToolTip?.ToString() ?? string.Empty;
break;
- case ToggleButton toggle:
- description = toggle.Description?.ToString() ?? string.Empty;
- break;
- default:
+ case ToggleButton tglButton:
+ description = tglButton.Description?.ToString() ?? string.Empty;
+ state = tglButton.State;
break;
}
if (DescBlock.Text != description)
{
DescBlock.Text = description;
+ DescBlock.TargetState = state;
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e)
+ {
+ DescBlock.Text = DescBlock.DefaultText;
+ DescBlock.TargetState = null;
+ }
private void ColorPicker_ColorPicked(object sender, EventArgs e)
{
@@ -80,16 +85,18 @@ namespace GTweak.View
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
- ToggleButton toggleButton = (ToggleButton)sender;
+ ToggleButton tglButton = (ToggleButton)sender;
+
+ DescBlock.TargetState = tglButton.State;
- _intfTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
+ _intfTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
- if (ExplorerManager.IntfActions.TryGetValue(toggleButton.Name, out ExplorerManager.ExplorerAction explorerAction) && explorerAction == ExplorerManager.ExplorerAction.Restart)
+ if (ExplorerManager.IntfActions.TryGetValue(tglButton.Name, out ExplorerManager.ExplorerAction explorerAction) && explorerAction == ExplorerManager.ExplorerAction.Restart)
{
ExplorerManager.Restart();
}
- if (NotificationManager.IntfActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction noticeAction))
+ if (NotificationManager.IntfActions.TryGetValue(tglButton.Name, out NotificationManager.NoticeAction noticeAction))
{
NotificationManager.Show().WithDelay(300).Perform(noticeAction);
}
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index 931a64c7..96ce0cb4 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -19,19 +19,26 @@ namespace GTweak.View
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
{
- string description = ((ToggleButton)sender!).Description?.ToString() ?? string.Empty;
-
- if (DescBlock.Text != description)
+ if (sender is ToggleButton tglButton && DescBlock.Text != tglButton.Description?.ToString())
{
- DescBlock.Text = description;
+ DescBlock.Text = tglButton.Description?.ToString() ?? string.Empty;
+ DescBlock.TargetState = tglButton.State;
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e)
+ {
+ DescBlock.Text = DescBlock.DefaultText;
+ DescBlock.TargetState = null;
+ }
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
- _svcTweaks.ApplyTweaks(((ToggleButton)sender).Name, ((ToggleButton)sender).State);
+ ToggleButton tglButton = (ToggleButton)sender;
+
+ DescBlock.TargetState = tglButton.State;
+
+ _svcTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
NotificationManager.Show().WithDelay(300).Restart();
}
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 56900c4d..9a1df48e 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -20,44 +20,52 @@ namespace GTweak.View
private void Tweak_MouseEnter(object sender, MouseEventArgs e)
{
string description = string.Empty;
+ bool? state = null;
switch (sender)
{
case StackPanel panel:
description = panel.ToolTip?.ToString() ?? string.Empty;
break;
- case ToggleButton toggle:
- description = toggle.Description?.ToString() ?? string.Empty;
- break;
- default:
+ case ToggleButton tglButton:
+ description = tglButton.Description?.ToString() ?? string.Empty;
+ state = tglButton.State;
break;
}
if (DescBlock.Text != description)
{
DescBlock.Text = description;
+ DescBlock.TargetState = state;
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e)
+ {
+ DescBlock.Text = DescBlock.DefaultText;
+ DescBlock.TargetState = null;
+ }
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) => _sysTweaks.ApplyTweaks(((Slider)sender).Name, (uint)((Slider)sender).Value);
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
- ToggleButton toggleButton = (ToggleButton)sender;
- if (toggleButton.Name != "TglButton3")
+ ToggleButton tglButton = (ToggleButton)sender;
+
+ DescBlock.TargetState = tglButton.State;
+
+ if (tglButton.Name != "TglButton3")
{
- _sysTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
+ _sysTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
- if (NotificationManager.SysActions.TryGetValue(toggleButton.Name, out NotificationManager.NoticeAction action))
+ if (NotificationManager.SysActions.TryGetValue(tglButton.Name, out NotificationManager.NoticeAction action))
{
NotificationManager.Show().WithDelay(300).Perform(action);
}
}
else
{
- _sysTweaks.ApplyTweaks(toggleButton.Name, toggleButton.State);
+ _sysTweaks.ApplyTweaks(tglButton.Name, tglButton.State);
}
}
}