Skip to content

Portable Tool for an Ideal Windows Setup

fix minor issues and remove opacity mask for combobox

Greedeksdb4d23c25997
diff --git a/.Source/GTweak/Converters/ScrollFadeMaskConverter.cs b/.Source/GTweak/Converters/ScrollFadeMaskConverter.cs
deleted file mode 100644
index 09c7540f..00000000
--- a/.Source/GTweak/Converters/ScrollFadeMaskConverter.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows;
-using System.Windows.Data;
-using System.Windows.Media;
-using GTweak.Utilities.Controls;
-
-namespace GTweak.Converters
-{
- public class ScrollFadeMaskConverter : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- if (values.Length < 3 || values[0] == DependencyProperty.UnsetValue || values[1] == DependencyProperty.UnsetValue || values[2] == DependencyProperty.UnsetValue)
- {
- return Brushes.White;
- }
-
- double offset = (double)values[0];
- double viewportHeight = (double)values[1];
- double extentHeight = (double)values[2];
-
- if (viewportHeight <= 0 || extentHeight <= 0)
- {
- return Brushes.White;
- }
-
- double scrollableHeight = Math.Max(0, extentHeight - viewportHeight);
-
- if (scrollableHeight <= 0)
- {
- return Brushes.White;
- }
-
- double fadeHeight = Math.Min(30.0, viewportHeight * 0.5);
-
- if (fadeHeight < 4)
- {
- return Brushes.White;
- }
-
- double epsilon = 0.5;
-
- double visibleStart = offset;
- double visibleEnd = offset + viewportHeight;
-
- bool showTopFade = visibleStart > epsilon;
- bool showBottomFade = visibleEnd < extentHeight - epsilon;
-
- double topFadeEnd = fadeHeight / viewportHeight;
- double bottomFadeStart = 1.0 - (fadeHeight / viewportHeight);
-
- LinearGradientBrush brush = new LinearGradientBrush
- {
- StartPoint = new Point(0, 0),
- EndPoint = new Point(0, 1)
- };
-
- if (showTopFade)
- {
- brush.GradientStops.Add(new GradientStop(Colors.Transparent, 0.0));
- brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xAA, 0xFF, 0xFF, 0xFF), topFadeEnd * 0.5));
- brush.GradientStops.Add(new GradientStop(Colors.White, topFadeEnd));
- }
- else
- {
- brush.GradientStops.Add(new GradientStop(Colors.White, 0.0));
- brush.GradientStops.Add(new GradientStop(Colors.White, topFadeEnd));
- }
-
- brush.GradientStops.Add(new GradientStop(Colors.White, bottomFadeStart));
-
- if (showBottomFade)
- {
- brush.GradientStops.Add(new GradientStop(Colors.White, bottomFadeStart));
- brush.GradientStops.Add(new GradientStop(Color.FromArgb(0xAA, 0xFF, 0xFF, 0xFF), bottomFadeStart + (topFadeEnd * 0.5)));
- brush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
- }
- else
- {
- brush.GradientStops.Add(new GradientStop(Colors.White, 1.0));
- }
-
- return brush;
- }
-
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- ErrorLogging.LogWritingFile(new NotImplementedException());
- return Array.Empty<object>();
- }
- }
-}
diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csproj
index 92723dd0..b18657f7 100644
--- a/.Source/GTweak/GTweak.csproj
+++ b/.Source/GTweak/GTweak.csproj
@@ -148,7 +148,6 @@
<Compile Include="Core\ViewModel\PakagesViewModel.cs" />
<Compile Include="Core\ViewModel\ServicesViewModel.cs" />
<Compile Include="Core\ViewModel\SystemViewModel.cs" />
- <Compile Include="Converters\ScrollFadeMaskConverter.cs" />
<Compile Include="Utilities\Configuration\DiskTypeIdentifier.cs" />
<Compile Include="Utilities\Configuration\HardwareData.cs" />
<Compile Include="Utilities\Helpers\UnlockHandleHelper.cs" />
diff --git a/.Source/GTweak/Styles/Inputs/ComboBox.xaml b/.Source/GTweak/Styles/Inputs/ComboBox.xaml
index 83acd10c..6332f82a 100644
--- a/.Source/GTweak/Styles/Inputs/ComboBox.xaml
+++ b/.Source/GTweak/Styles/Inputs/ComboBox.xaml
@@ -1,5 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:conv="clr-namespace:GTweak.Converters"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CustomComboBoxItemStyle" TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
@@ -113,7 +112,7 @@
<Setter Property="Height" Value="28"/>
<Setter Property="BorderBrush" Value="{StaticResource Brush_Separator}"/>
<Setter Property="BorderThickness" Value="1"/>
- <Setter Property="MaxDropDownHeight" Value="220"/>
+ <Setter Property="MaxDropDownHeight" Value="230"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
@@ -166,7 +165,7 @@
<Popup x:Name="Popup" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" VerticalOffset="2" AllowsTransparency="True" Focusable="False">
<Border x:Name="PopupBorder"
Width="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
- Background="{StaticResource Brush_Background_СomboBox}"
+ Background="{StaticResource Brush_Background_ComboBox}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"
@@ -177,21 +176,9 @@
<ScaleTransform x:Name="PopupScale" ScaleY="0" />
</Border.RenderTransform>
<ScrollViewer x:Name="PART_ScrollViewer" MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="1,4,8,4">
- <Grid>
- <Border>
- <Border.OpacityMask>
- <MultiBinding>
- <MultiBinding.Converter>
- <conv:ScrollFadeMaskConverter/>
- </MultiBinding.Converter>
- <Binding ElementName="PART_ScrollViewer" Path="VerticalOffset"/>
- <Binding ElementName="PART_ScrollViewer" Path="ViewportHeight"/>
- <Binding ElementName="PART_ScrollViewer" Path="ExtentHeight"/>
- </MultiBinding>
- </Border.OpacityMask>
- <ItemsPresenter/>
- </Border>
- </Grid>
+ <VirtualizingStackPanel>
+ <ItemsPresenter/>
+ </VirtualizingStackPanel>
</ScrollViewer>
</Border>
</Popup>
diff --git a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
index d386226c..c53b44a5 100644
--- a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
@@ -23,7 +23,7 @@
<SolidColorBrush x:Key="Brush_Separator" Color="#434544"/>
- <SolidColorBrush x:Key="Brush_Background_СomboBox" Color="#2C2E2D"/>
+ <SolidColorBrush x:Key="Brush_Background_ComboBox" Color="#2C2E2D"/>
<SolidColorBrush x:Key="Brush_ComboBoxBorder_Hover" Color="#65ffa9"/>
<SolidColorBrush x:Key="Brush_ComboBoxBG_Active" Color="#3b3b3b"/>
diff --git a/.Source/GTweak/Styles/Themes/Light/Colors.xaml b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
index 0827f228..783ca610 100644
--- a/.Source/GTweak/Styles/Themes/Light/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
@@ -23,7 +23,7 @@
<SolidColorBrush x:Key="Brush_Separator" Color="#C8C8C8"/>
- <SolidColorBrush x:Key="Brush_Background_СomboBox" Color="#F9F9F9"/>
+ <SolidColorBrush x:Key="Brush_Background_ComboBox" Color="#F9F9F9"/>
<SolidColorBrush x:Key="Brush_ComboBoxBorder_Hover" Color="#008C47"/>
<SolidColorBrush x:Key="Brush_ComboBoxBG_Active" Color="#E0E0E0"/>
diff --git a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs b/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
index 851af044..32d8c378 100644
--- a/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/FactoryAnimation.cs
@@ -19,7 +19,7 @@ namespace GTweak.Utilities.Animation
if (onCompleted != null)
{
- doubleAnim.Completed += (s, e) => onCompleted();
+ doubleAnim.Completed += delegate { onCompleted(); };
}
Timeline.SetDesiredFrameRate(doubleAnim, 120);
@@ -32,7 +32,7 @@ namespace GTweak.Utilities.Animation
if (onCompleted != null)
{
- doubleAnim.Completed += (s, e) => onCompleted();
+ doubleAnim.Completed += delegate { onCompleted(); };
}
Timeline.SetDesiredFrameRate(doubleAnim, 120);
diff --git a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs b/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
index 55f8e1fb..fefa1191 100644
--- a/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
+++ b/.Source/GTweak/Utilities/Animation/TypewriterAnimation.cs
@@ -29,7 +29,7 @@ namespace GTweak.Utilities.Animation
Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath(UIElement.OpacityProperty));
storyboard.Children.Add(opacityAnimation);
- handler = (s, e) =>
+ handler = delegate
{
storyboard.Children.Clear();
storyboard.Completed -= handler;
diff --git a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
index 141391a4..f1f0eaea 100644
--- a/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
+++ b/.Source/GTweak/Utilities/Helpers/CommandExecutor.cs
@@ -110,7 +110,7 @@ namespace GTweak.Utilities.Helpers
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
process.EnableRaisingEvents = true;
- process.Exited += (sender, args) => tcs.TrySetResult(null);
+ process.Exited += delegate { tcs.TrySetResult(null); };
return tcs.Task;
}
@@ -121,12 +121,7 @@ namespace GTweak.Utilities.Helpers
return string.Empty;
}
- var lines = rawCommand
- .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
- .Select(line => line.Trim())
- .Where(line => !string.IsNullOrEmpty(line))
- .Select(line => Regex.Replace(line, @"\s+", " "))
- .ToList();
+ var lines = rawCommand.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(line => line.Trim()).Where(line => !string.IsNullOrEmpty(line)).Select(line => Regex.Replace(line, @"\s+", " ")).ToList();
if (lines.Count == 0)
{
diff --git a/.Source/GTweak/Utilities/Managers/NotificationManager.cs b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
index d0c5ed94..d69b4e6b 100644
--- a/.Source/GTweak/Utilities/Managers/NotificationManager.cs
+++ b/.Source/GTweak/Utilities/Managers/NotificationManager.cs
@@ -99,7 +99,7 @@ namespace GTweak.Utilities.Managers
window.NoticeText = Application.Current.Resources[action == NoticeAction.Logout ? "logout_noty" : "restart_noty"] as string;
}
- window.Closed += (s, e) => Interlocked.Exchange(ref _isNotificationOpen, 0);
+ window.Closed += delegate { Interlocked.Exchange(ref _isNotificationOpen, 0); };
await Task.Delay(_delayMs).ContinueWith(_ =>
{
diff --git a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
index 5e3ab16d..04bad84d 100644
--- a/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
+++ b/.Source/GTweak/Utilities/Tweaks/SystemTweaks.cs
@@ -182,7 +182,7 @@ namespace GTweak.Utilities.Tweaks
}
- internal void ViewBluetoothStatus()
+ internal static void ViewBluetoothStatus()
{
try
{
@@ -192,13 +192,13 @@ namespace GTweak.Utilities.Tweaks
catch { _isBluetoothStatus = false; }
}
- internal void ViewNetshState()
+ internal static void ViewNetshState()
{
string getStateNetsh = CommandExecutor.GetCommandOutput("/c chcp 65001 & netsh int teredo show state & netsh int ipv6 isatap show state & netsh int isatap show state & netsh int ipv6 6to4 show state", false).Result;
_isNetshState = getStateNetsh.Contains("default") || getStateNetsh.Contains("enabled");
}
- internal void ViewConfigTick()
+ internal static void ViewConfigTick()
{
string output = CommandExecutor.GetCommandOutput(PathLocator.Executable.BcdEdit).Result;
_isTickState = !Regex.IsMatch(output, @"(?is)(?=.*\bdisabledynamictick\s+(yes|true))(?=.*\buseplatformclock\s+(no|false))", RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant);
@@ -237,7 +237,7 @@ namespace GTweak.Utilities.Tweaks
switch (tweak)
{
case "TglButton1":
- SystemParametersInfo(UIAction.SPI_SETMOUSE, 0, isDisabled ? new uint[3] : new uint[3] { 1, 6, 10 }, 2);
+ SystemParametersInfo(UIAction.SPI_SETMOUSE, 0, isDisabled ? new uint[3] : new uint[] { 1, 6, 10 }, 2);
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseSpeed", isDisabled ? "0" : "1", RegistryValueKind.String);
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold1", isDisabled ? "0" : "6", RegistryValueKind.String);
RegistryHelp.Write(Registry.CurrentUser, @"Control Panel\Mouse", "MouseThreshold2", isDisabled ? "0" : "10", RegistryValueKind.String);
diff --git a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
index c01ffd97..21b04f23 100644
--- a/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
+++ b/.Source/GTweak/Utilities/Tweaks/UninstallingPakages.cs
@@ -109,7 +109,7 @@ namespace GTweak.Utilities.Tweaks
return false;
}
- internal async void CheckingForLocalAccount()
+ internal async static void CheckingForLocalAccount()
{
string output = await CommandExecutor.GetCommandOutput("Get-LocalUser | Where-Object { $_.Enabled -match 'True'} | Select-Object -ExpandProperty PrincipalSource");
_isLocalAccount = output.IndexOf("MicrosoftAccount", StringComparison.OrdinalIgnoreCase) < 0;
@@ -340,7 +340,6 @@ namespace GTweak.Utilities.Tweaks
}
}
catch (Exception ex) { ErrorLogging.LogDebug(ex); }
-
break;
}
});
diff --git a/.Source/GTweak/View/ConfidentialityView.xaml.cs b/.Source/GTweak/View/ConfidentialityView.xaml.cs
index 50a23414..3db875df 100644
--- a/.Source/GTweak/View/ConfidentialityView.xaml.cs
+++ b/.Source/GTweak/View/ConfidentialityView.xaml.cs
@@ -26,13 +26,7 @@ namespace GTweak.View
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e)
- {
- if (DescBlock.Text != DescBlock.DefaultText)
- {
- DescBlock.Text = DescBlock.DefaultText;
- }
- }
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
diff --git a/.Source/GTweak/View/InterfaceView.xaml.cs b/.Source/GTweak/View/InterfaceView.xaml.cs
index 9b607af1..b11b4bc7 100644
--- a/.Source/GTweak/View/InterfaceView.xaml.cs
+++ b/.Source/GTweak/View/InterfaceView.xaml.cs
@@ -34,13 +34,7 @@ namespace GTweak.View
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e)
- {
- if (DescBlock.Text != DescBlock.DefaultText)
- {
- DescBlock.Text = DescBlock.DefaultText;
- }
- }
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
diff --git a/.Source/GTweak/View/PakagesView.xaml.cs b/.Source/GTweak/View/PakagesView.xaml.cs
index d0e8ed64..89a35559 100644
--- a/.Source/GTweak/View/PakagesView.xaml.cs
+++ b/.Source/GTweak/View/PakagesView.xaml.cs
@@ -49,13 +49,7 @@ namespace GTweak.View
}
}
- private void Package_MouseLeave(object sender, MouseEventArgs e)
- {
- if (DescBlock.Text != DescBlock.DefaultText)
- {
- DescBlock.Text = DescBlock.DefaultText;
- }
- }
+ private void Package_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
private async void ToggleButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
diff --git a/.Source/GTweak/View/ServicesView.xaml.cs b/.Source/GTweak/View/ServicesView.xaml.cs
index 252c481a..7dd80e4d 100644
--- a/.Source/GTweak/View/ServicesView.xaml.cs
+++ b/.Source/GTweak/View/ServicesView.xaml.cs
@@ -26,13 +26,7 @@ namespace GTweak.View
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e)
- {
- if (DescBlock.Text != DescBlock.DefaultText)
- {
- DescBlock.Text = DescBlock.DefaultText;
- }
- }
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
private void TglButton_ChangedState(object sender, RoutedEventArgs e)
{
diff --git a/.Source/GTweak/View/SystemView.xaml.cs b/.Source/GTweak/View/SystemView.xaml.cs
index 50a4f728..c9c2bf82 100644
--- a/.Source/GTweak/View/SystemView.xaml.cs
+++ b/.Source/GTweak/View/SystemView.xaml.cs
@@ -37,13 +37,7 @@ namespace GTweak.View
}
}
- private void Tweak_MouseLeave(object sender, MouseEventArgs e)
- {
- if (DescBlock.Text != DescBlock.DefaultText)
- {
- DescBlock.Text = DescBlock.DefaultText;
- }
- }
+ private void Tweak_MouseLeave(object sender, MouseEventArgs e) => DescBlock.Text = DescBlock.DefaultText;
private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) => _sysTweaks.ApplyTweaksSlider(((Slider)sender).Name, (uint)((Slider)sender).Value);
diff --git a/.Source/GTweak/Windows/LoadingWindow.xaml.cs b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
index 7d190f40..0594002e 100644
--- a/.Source/GTweak/Windows/LoadingWindow.xaml.cs
+++ b/.Source/GTweak/Windows/LoadingWindow.xaml.cs
@@ -15,7 +15,6 @@ namespace GTweak.Windows
public partial class LoadingWindow : FluentWindow
{
private readonly SystemDiagnostics _systemDiagnostics = new SystemDiagnostics();
- private readonly SystemTweaks _systemTweaks = new SystemTweaks();
private readonly UninstallingPakages _uninstallingPakages = new UninstallingPakages();
public LoadingWindow()
@@ -59,10 +58,10 @@ namespace GTweak.Windows
() => ExecuteWithLogging(_systemDiagnostics.GetHardwareData, nameof(_systemDiagnostics.GetHardwareData)),
() => ExecuteWithLogging(_systemDiagnostics.ValidateVersionUpdates, nameof(_systemDiagnostics.ValidateVersionUpdates)),
() => ExecuteWithLogging(_uninstallingPakages.GetInstalledPackages, nameof(_uninstallingPakages.GetInstalledPackages)),
- () => ExecuteWithLogging(_uninstallingPakages.CheckingForLocalAccount, nameof(_uninstallingPakages.CheckingForLocalAccount)),
- () => ExecuteWithLogging(_systemTweaks.ViewNetshState, nameof(_systemTweaks.ViewNetshState)),
- () => ExecuteWithLogging(_systemTweaks.ViewBluetoothStatus, nameof(_systemTweaks.ViewBluetoothStatus)),
- () => ExecuteWithLogging(_systemTweaks.ViewConfigTick, nameof(_systemTweaks.ViewConfigTick))
+ () => ExecuteWithLogging(UninstallingPakages.CheckingForLocalAccount, nameof(UninstallingPakages.CheckingForLocalAccount)),
+ () => ExecuteWithLogging(SystemTweaks.ViewNetshState, nameof(SystemTweaks.ViewNetshState)),
+ () => ExecuteWithLogging(SystemTweaks.ViewBluetoothStatus, nameof(SystemTweaks.ViewBluetoothStatus)),
+ () => ExecuteWithLogging(SystemTweaks.ViewConfigTick, nameof(SystemTweaks.ViewConfigTick))
);
ExecuteWithLogging(() => HardwareData.RunningProcessesCount = _systemDiagnostics.GetProcessCount().Result, nameof(_systemDiagnostics.GetProcessCount));
diff --git a/.Source/GTweak/Windows/UpdateWindow.xaml.cs b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
index 1dbbc6ea..b0371b02 100644
--- a/.Source/GTweak/Windows/UpdateWindow.xaml.cs
+++ b/.Source/GTweak/Windows/UpdateWindow.xaml.cs
@@ -35,7 +35,7 @@ namespace GTweak.Windows
string tempFileName = $"GTweak_{Guid.NewGuid().ToString("N").Substring(0, 8)}.exe";
using WebClient webClient = new WebClient();
- webClient.DownloadProgressChanged += (s, e) =>
+ webClient.DownloadProgressChanged += (_, e) =>
{
ProgressDownload.Value = e.ProgressPercentage;
SizeByte.Text = $"{Math.Round(e.BytesReceived / 1024.0)} KB / {Math.Round(e.TotalBytesToReceive / 1024.0)} KB";