Skip to content

Portable Tool for an Ideal Windows Setup

fix visual condition mismatch

Greedeks3f1ad32a65a4
diff --git a/.Source/GTweak/View/DataSystemView.xaml b/.Source/GTweak/View/DataSystemView.xaml
index baa990c0..e2619991 100644
--- a/.Source/GTweak/View/DataSystemView.xaml
+++ b/.Source/GTweak/View/DataSystemView.xaml
@@ -305,7 +305,7 @@
<BlurEffect Radius="{Binding SetBlurValue}"/>
</TextBlock.Effect>
</TextBlock>
- <ToggleButton x:Name="BtnVision" Margin="10,0,0,0" Width="24" Height="24" Visibility="{Binding SetVisibility}" VerticalAlignment="Center" Style="{StaticResource TglVision}" IsChecked="{Binding StateButtonVision}" Click="BtnVision_Click"/>
+ <ToggleButton x:Name="BtnVision" Margin="10,0,0,0" Width="24" Height="24" Visibility="{Binding SetVisibility}" VerticalAlignment="Center" Style="{StaticResource TglVision}" IsChecked="{Binding StateButtonVision}" PreviewMouseLeftButtonUp="BtnVision_PreviewMouseLeftButtonUp" PreviewKeyDown="BtnVision_PreviewKeyDown"/>
</StackPanel>
</StackPanel>
diff --git a/.Source/GTweak/View/DataSystemView.xaml.cs b/.Source/GTweak/View/DataSystemView.xaml.cs
index b60ac328..d695ed47 100644
--- a/.Source/GTweak/View/DataSystemView.xaml.cs
+++ b/.Source/GTweak/View/DataSystemView.xaml.cs
@@ -102,12 +102,20 @@ namespace GTweak.View
PopupCopy.BeginAnimation(Popup.VerticalOffsetProperty, FactoryAnimation.CreateIn(-20, -50, 0.35, null, false, true));
}
- private void BtnVision_Click(object sender, RoutedEventArgs e)
+ private void BtnVision_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
SettingsEngine.IsHiddenIpAddress = !BtnVision.IsChecked.Value;
IpAddress.Effect.BeginAnimation(BlurEffect.RadiusProperty, BtnVision.IsChecked.Value ? FactoryAnimation.CreateTo(0.2) : FactoryAnimation.CreateIn(0, 20, 0.2));
}
+ private void BtnVision_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Space || e.Key == Key.Enter)
+ {
+ e.Handled = true;
+ }
+ }
+
private void HandleCopyingData_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
diff --git a/.Source/GTweak/Windows/MainWindow.xaml b/.Source/GTweak/Windows/MainWindow.xaml
index ec175e8c..39fcd2d8 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml
+++ b/.Source/GTweak/Windows/MainWindow.xaml
@@ -25,7 +25,7 @@
<ToggleButton x:Name="ButtonTheme" IsChecked="{Binding StateButtonTheme}" Style="{StaticResource TglThemeSwitch}" Margin="0,0,0,2" HorizontalAlignment="Right" VerticalAlignment="Center" Click="TitleButton_Click"/>
- <Button x:Name="ButtonSettings" Style="{StaticResource TitleButtonSettings}" Margin="0,0,10,2" HorizontalAlignment="Right" VerticalAlignment="Center" Click="TitleButton_Click"/>
+ <Button x:Name="ButtonSettings" Style="{StaticResource TitleButtonSettings}" Margin="0,0,10,2" HorizontalAlignment="Right" VerticalAlignment="Center" Click="TitleButton_Click" PreviewKeyDown="TglButton_PreviewKeyDown"/>
<Button x:Name="ButtonMinimize" Style="{StaticResource TitleButtonMinimize}" Margin="0,0,0,2" HorizontalAlignment="Right" VerticalAlignment="Center" Click="TitleButton_Click"/>
@@ -123,7 +123,7 @@
<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, Mode=OneWay}" Width="20" Height="20" Margin="10,4,0,0" Style="{StaticResource TglVolume}" Click="BtnVolume_Click"/>
+ <ToggleButton x:Name="BtnVolume" IsChecked="{Binding IsPlayingSound, Mode=OneWay}" Width="20" Height="20" Margin="10,4,0,0" Style="{StaticResource TglVolume}" PreviewMouseLeftButtonUp="BtnVolume_PreviewMouseLeftButtonUp" PreviewKeyDown="TglButton_PreviewKeyDown"/>
<Slider x:Name="SliderVolume" Style="{StaticResource Percent_Slider}" Value="{Binding CurrentVolume, Mode=OneWay}" IsSnapToTickEnabled="True" Minimum="0" Maximum="100" Margin="10,5,0,0" Width="187" Height="12" ValueChanged="SliderVolume_ValueChanged"/>
</StackPanel>
</Viewbox>
diff --git a/.Source/GTweak/Windows/MainWindow.xaml.cs b/.Source/GTweak/Windows/MainWindow.xaml.cs
index 1b0f4aa4..3a288b2b 100644
--- a/.Source/GTweak/Windows/MainWindow.xaml.cs
+++ b/.Source/GTweak/Windows/MainWindow.xaml.cs
@@ -85,6 +85,14 @@ namespace GTweak.Windows
break;
}
}
+
+ private void TglButton_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Space || e.Key == Key.Enter)
+ {
+ e.Handled = true;
+ }
+ }
#endregion
#region SettingsPanel
@@ -94,7 +102,7 @@ namespace GTweak.Windows
private void BtnTopMost_ChangedState(object sender, RoutedEventArgs e) => SettingsEngine.IsTopMost = Topmost = !BtnTopMost.State;
- private void BtnVolume_Click(object sender, RoutedEventArgs e) => SettingsEngine.IsPlayingSound = (bool)!BtnVolume.IsChecked;
+ private void BtnVolume_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) => SettingsEngine.IsPlayingSound = (bool)!BtnVolume.IsChecked;
private void SliderVolume_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{