Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
fix resolve progress bar overlay overlapping
Greedeksbe07c8672df5
diff --git a/.Source/GTweak/Assets/UserControls/FlowPanel.cs b/.Source/GTweak/Assets/UserControls/FlowPanel.csindex b3aaccb8..251eec3a 100644--- a/.Source/GTweak/Assets/UserControls/FlowPanel.cs+++ b/.Source/GTweak/Assets/UserControls/FlowPanel.cs@@ -180,21 +180,44 @@ namespace GTweak.Assets.UserControlsdouble aw = availableSize.Width;double ah = availableSize.Height;- Size constraint = EqualizeItemSize ? new Size(ItemWidth, double.PositiveInfinity) : new Size(aw, double.PositiveInfinity);+ double finiteAw = (double.IsInfinity(aw) || double.IsNaN(aw) || aw <= 0) ? (double)(double.IsInfinity(MaxWidth) ? 320.0 : MaxWidth) : aw;double totalItemWidth = 0;double maxItemHeight = 0;double totalVerticalHeight = 0;double maxItemWidth = 0;- for (int i = 0; i < count; i++)+ if (ResponsiveMode){- var child = _visibleCache[i];- child?.Measure(constraint);+ for (int i = 1; i < count; i++)+ {+ _visibleCache[i]?.Measure(new Size(finiteAw, double.PositiveInfinity));+ }- double cw = GetChildWidth(child);- double ch = GetChildHeight(child);+ if (count > 1)+ {+ double lastChildWidth = _visibleCache[count - 1].DesiredSize.Width;+ double firstMaxWidth = Math.Max(0, finiteAw - lastChildWidth - HorizontalSpacing - 30.0);+ _visibleCache[0]?.Measure(new Size(firstMaxWidth, double.PositiveInfinity));+ }+ else+ {+ _visibleCache[0]?.Measure(new Size(finiteAw, double.PositiveInfinity));+ }+ }+ else+ {+ Size constraint = EqualizeItemSize ? new Size(ItemWidth, double.PositiveInfinity) : new Size(finiteAw, double.PositiveInfinity);+ for (int i = 0; i < count; i++)+ {+ _visibleCache[i]?.Measure(constraint);+ }+ }+ for (int i = 0; i < count; i++)+ {+ double cw = _visibleCache[i].DesiredSize.Width;+ double ch = _visibleCache[i].DesiredSize.Height;totalItemWidth += cw;totalVerticalHeight += ch;if (ch > maxItemHeight)@@ -212,38 +235,11 @@ namespace GTweak.Assets.UserControls{if (_cachedLayout != null) { ReleaseGroups(_cachedLayout); _cachedLayout = null; }- double smallOffset = 30.0;- double horizontalRequired = totalItemWidth;- if (count > 1)- {- horizontalRequired += smallOffset;- if (count > 2)- {- horizontalRequired += (count - 2) * HorizontalSpacing;- }- }+ double horizontalRequired = totalItemWidth + (count > 1 ? 30.0 : 0) + (count > 2 ? (count - 2) * HorizontalSpacing : 0);- double verticalRequired = 0;- if (count > 1)- {- double buttonHeight = GetChildHeight(_visibleCache[count - 1]);- verticalRequired = totalVerticalHeight - buttonHeight + ((count - 2) * VerticalSpacing);- verticalRequired = Math.Max(verticalRequired, buttonHeight);- }- else- {- verticalRequired = totalVerticalHeight;- }+ double verticalRequired = (count > 1) ? Math.Max(totalVerticalHeight - _visibleCache[count - 1].DesiredSize.Height + (count - 2) * VerticalSpacing, _visibleCache[count - 1].DesiredSize.Height) : totalVerticalHeight;- Size resultSize;- if (horizontalRequired <= aw || double.IsInfinity(aw))- {- resultSize = new Size(double.IsInfinity(aw) ? horizontalRequired : aw, maxItemHeight);- }- else- {- resultSize = new Size(double.IsInfinity(aw) ? maxItemWidth : aw, verticalRequired);- }+ Size resultSize = (horizontalRequired <= aw || double.IsInfinity(aw)) ? new Size(double.IsInfinity(aw) ? horizontalRequired : aw, maxItemHeight) : new Size(double.IsInfinity(aw) ? maxItemWidth : aw, verticalRequired);_cachedMeasureWidth = resultSize.Width;return resultSize;@@ -251,17 +247,17 @@ namespace GTweak.Assets.UserControlsif (_cachedLayout != null){- ReleaseGroups(_cachedLayout); _cachedLayout = null;+ ReleaseGroups(_cachedLayout);+ _cachedLayout = null;}-_cachedLayout = CreateOptimalColumns(aw, ah, _visibleCache);- double neededHeight = CalculateLayoutHeight(_cachedLayout);+ double finalHeight = CalculateLayoutHeight(_cachedLayout);double finalWidth = double.IsInfinity(aw) ? CalculateTotalWidth(_cachedLayout) : aw;_cachedMeasureWidth = finalWidth;- return new Size(finalWidth, neededHeight);+ return new Size(finalWidth, finalHeight);}catch (Exception ex){@@ -278,41 +274,37 @@ namespace GTweak.Assets.UserControlsreturn;}- double smallOffset = 30.0;+ double width = (double.IsInfinity(finalSize.Width) || finalSize.Width <= 0) ? (_cachedMeasureWidth > 0 ? _cachedMeasureWidth : 320.0) : finalSize.Width;+double totalWidth = 0;for (int i = 0; i < count; i++){- totalWidth += GetChildWidth(_visibleCache[i]);+ totalWidth += _visibleCache[i].DesiredSize.Width;}- double horizontalRequired = totalWidth;- if (count > 1)- {- horizontalRequired += smallOffset;- if (count > 2)- {- horizontalRequired += (count - 2) * HorizontalSpacing;- }- }+ double horizontalRequired = totalWidth + (count > 1 ? 30.0 : 0) + (count > 2 ? (count - 2) * HorizontalSpacing : 0);+ double lastChildWidth = count > 1 ? _visibleCache[count - 1].DesiredSize.Width : 0;if (horizontalRequired <= finalSize.Width || double.IsInfinity(finalSize.Width)){double x = 0;+ double availableLeftWidth = Math.Max(0, width - lastChildWidth - HorizontalSpacing);for (int i = 0; i < count; i++){- UIElement child = _visibleCache[i];- double w = GetChildWidth(child);- double h = GetChildHeight(child);+ var child = _visibleCache[i];+ double w = child.DesiredSize.Width;+ double h = child.DesiredSize.Height;double y = Math.Max(0, (finalSize.Height - h) / 2.0);if (i == count - 1 && count > 1){- child.Arrange(new Rect(finalSize.Width - w, y, w, h));+ child.Arrange(new Rect(width - w, y, w, h));}else{- child.Arrange(new Rect(x, y, w, h));- x += w + (i == 0 ? smallOffset : HorizontalSpacing);+ double arrangeWidth = Math.Min(w, Math.Max(0, availableLeftWidth - x));+ child.Arrange(new Rect(x, y, arrangeWidth, h));+ x += arrangeWidth + (i == 0 ? 30.0 : HorizontalSpacing);}}}@@ -321,19 +313,20 @@ namespace GTweak.Assets.UserControlsdouble y = 0;for (int i = 0; i < count; i++){- UIElement child = _visibleCache[i];- double w = GetChildWidth(child);- double h = GetChildHeight(child);+ var child = _visibleCache[i];+ double w = child.DesiredSize.Width;+ double h = child.DesiredSize.Height;if (i == count - 1 && count > 1){- double buttonY = Math.Max(0, (GetChildHeight(_visibleCache[0]) - h) / 2.0);- child.Arrange(new Rect(finalSize.Width - w, buttonY, w, h));+ double buttonY = Math.Max(0, (_visibleCache[0].DesiredSize.Height - h) / 2.0);+ child.Arrange(new Rect(width - w, buttonY, w, h));}else{- double xOffset = GetResponsiveAlignmentOffset(finalSize.Width, w);- child.Arrange(new Rect(xOffset, y, w, h));+ double maxWidth = (i == 0 && count > 1) ? Math.Max(0, width - lastChildWidth - HorizontalSpacing - 30.0) : width;+ double arrangeWidth = Math.Min(w, maxWidth);+ child.Arrange(new Rect(GetResponsiveAlignmentOffset(width, arrangeWidth), y, arrangeWidth, h));y += h + VerticalSpacing;}}diff --git a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml b/.Source/GTweak/Assets/UserControls/ToolsetCard.xamlindex fdc1f315..dc617cd3 100644--- a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml+++ b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml@@ -14,24 +14,61 @@<TranslateTransform X="3" Y="6" /></Border.RenderTransform></Border>- <Border x:Name="CardBody" Background="{StaticResource Brush_Background_Card}" BorderBrush="{StaticResource Brush_Separator}" BorderThickness="1" CornerRadius="8" HorizontalAlignment="Left" VerticalAlignment="Top" SnapsToDevicePixels="True">+ <Border x:Name="CardBody" Background="{StaticResource Brush_Background_Card}" BorderThickness="1" CornerRadius="8" HorizontalAlignment="Left" VerticalAlignment="Top" SnapsToDevicePixels="True">+ <Border.BorderBrush>+ <SolidColorBrush Color="{StaticResource Color_Separator}"/>+ </Border.BorderBrush>+ <Border.Style>+ <Style TargetType="Border">+ <Style.Triggers>+ <Trigger Property="IsMouseOver" Value="True">+ <Trigger.EnterActions>+ <BeginStoryboard>+ <Storyboard Timeline.DesiredFrameRate="120">+ <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Border_Hover_CheckBox}" Duration="0:0:0.2"/>+ </Storyboard>+ </BeginStoryboard>+ </Trigger.EnterActions>+ <Trigger.ExitActions>+ <BeginStoryboard>+ <Storyboard Timeline.DesiredFrameRate="120">+ <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Separator}" Duration="0:0:0.1"/>+ </Storyboard>+ </BeginStoryboard>+ </Trigger.ExitActions>+ </Trigger>+ </Style.Triggers>+ </Style>+ </Border.Style><local:FlowPanel ResponsiveMode="True" HorizontalAlignment="Left" Margin="5" HorizontalSpacing="0" VerticalSpacing="5">- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">- <Image x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Stretch="Uniform"/>- <TextBlock x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center"/>- </StackPanel>+ <Grid VerticalAlignment="Center" HorizontalAlignment="Left">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto" />+ <ColumnDefinition Width="*" />+ </Grid.ColumnDefinitions>- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">- <Grid Width="25" Height="25" Margin="0,5,0,0">+ <Image Grid.Column="0" x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Stretch="Uniform"/>+ <TextBlock Grid.Column="1" x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>+ </Grid>++ <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,15,0">+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto"/>+ <ColumnDefinition Width="*" />+ <ColumnDefinition Width="Auto"/>+ <ColumnDefinition Width="Auto"/>+ </Grid.ColumnDefinitions>++ <Grid Grid.Column="0" Width="25" Height="25" Margin="0,5,0,0"><Border BorderBrush="{StaticResource Brush_Separator}" BorderThickness="0.5" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center"><Border.Style><Style TargetType="Border"><Setter Property="CornerRadius" Value="50"/><Style.Triggers><DataTrigger Binding="{Binding IsSquareIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">- <Setter Property="CornerRadius" Value="0"/>+ <Setter Property="CornerRadius" Value="5"/></DataTrigger></Style.Triggers></Style>@@ -69,16 +106,16 @@</Style></Path.Style><Path.Data>- <RectangleGeometry Rect="0,0,10,10"/>+ <RectangleGeometry Rect="0,0,10,10" RadiusX="2" RadiusY="2"/></Path.Data></Path></Grid>- <TextBlock Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" VerticalAlignment="Center" Margin="5,0,0,0"/>+ <TextBlock Grid.Column="1" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" VerticalAlignment="Center" Margin="5,0,0,0" TextTrimming="CharacterEllipsis"/>- <TextBlock Text=" • " Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" VerticalAlignment="Center" Margin="5,0,5,0"/>+ <TextBlock Grid.Column="2" Text=" • " Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" VerticalAlignment="Center" Margin="5,0,5,0"/>- <Border Background="Transparent" Cursor="Hand" VerticalAlignment="Center" SnapsToDevicePixels="True" BorderThickness="0,0,0,1" MouseLeftButtonDown="OpenSource_MouseLeftButtonDown">+ <Border Grid.Column="3" Background="Transparent" Cursor="Hand" VerticalAlignment="Center" SnapsToDevicePixels="True" BorderThickness="0,0,0,1" MouseLeftButtonDown="OpenSource_MouseLeftButtonDown"><Border.Style><Style TargetType="Border"><Setter Property="BorderBrush" Value="Transparent" />@@ -90,53 +127,55 @@</Style></Border.Style>- <StackPanel Orientation="Horizontal" Background="Transparent">- <TextBlock Text="{DynamicResource source_ts}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Accent}" VerticalAlignment="Center" Cursor="Hand"/>- <ui:SymbolIcon Symbol="Share20" FontSize="16" Foreground="{StaticResource Brush_Accent}" VerticalAlignment="Center" Margin="5,0,0,0" Cursor="Hand"/>- </StackPanel>- </Border>- </StackPanel>-- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">- <Grid VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,3,0,0">- <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}">- <Button.Style>- <Style TargetType="Button" BasedOn="{StaticResource ButtonContent}">- <Setter Property="Visibility" Value="Visible"/>- <Style.Triggers>- <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">- <Setter Property="Visibility" Value="Collapsed"/>- </DataTrigger>- </Style.Triggers>- </Style>- </Button.Style>- </Button>-- <Grid>- <Grid.Style>- <Style TargetType="Grid">- <Setter Property="Visibility" Value="Collapsed"/>- <Style.Triggers>- <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">- <Setter Property="Visibility" Value="Visible"/>- </DataTrigger>- </Style.Triggers>- </Style>- </Grid.Style>+ <Grid Background="Transparent"><Grid.ColumnDefinitions>- <ColumnDefinition Width="100"/>+ <ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>+ <TextBlock Grid.Column="0" Text="{DynamicResource source_ts}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Accent}" VerticalAlignment="Center" Cursor="Hand"/>+ <ui:SymbolIcon Grid.Column="1" Symbol="Share20" FontSize="16" Foreground="{StaticResource Brush_Accent}" VerticalAlignment="Center" Margin="5,0,0,0" Cursor="Hand"/>+ </Grid>+ </Border>+ </Grid>++ <Grid VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,3,0,0">+ <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}">+ <Button.Style>+ <Style TargetType="Button" BasedOn="{StaticResource ButtonContent}">+ <Setter Property="Visibility" Value="Visible"/>+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <Setter Property="Visibility" Value="Collapsed"/>+ </DataTrigger>+ </Style.Triggers>+ </Style>+ </Button.Style>+ </Button>- <Grid Grid.Column="0">- <TextBlock Panel.ZIndex="5" Text="{Binding Progress, StringFormat='{}{0:0}%', RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>- <ProgressBar Value="{Binding Progress, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Foreground="{StaticResource Brush_Accent}" Minimum="0" Maximum="100" Height="20" VerticalAlignment="Center"/>- </Grid>+ <Grid>+ <Grid.Style>+ <Style TargetType="Grid">+ <Setter Property="Visibility" Value="Collapsed"/>+ <Style.Triggers>+ <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <Setter Property="Visibility" Value="Visible"/>+ </DataTrigger>+ </Style.Triggers>+ </Style>+ </Grid.Style>+ <Grid.ColumnDefinitions>+ <ColumnDefinition Width="Auto"/>+ <ColumnDefinition Width="Auto"/>+ </Grid.ColumnDefinitions>- <Button Grid.Column="2" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent}" Command="{Binding CancelCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Margin="10,0,0,0"/>+ <Grid Grid.Column="0">+ <TextBlock Panel.ZIndex="5" Text="{Binding Progress, StringFormat='{}{0:0}%', RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>+ <ProgressBar Value="{Binding Progress, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Foreground="{StaticResource Brush_Accent}" Minimum="0" Maximum="100" Height="20" MinWidth="150" VerticalAlignment="Center"/></Grid>++ <Button Grid.Column="1" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent}" Command="{Binding CancelCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Margin="10,0,0,0"/></Grid>- </StackPanel>+ </Grid></local:FlowPanel></Border>diff --git a/.Source/GTweak/Core/Services/ToolsetDownloadService.cs b/.Source/GTweak/Core/Services/ToolsetDownloadService.csindex 6e5f4f10..8b4480d7 100644--- a/.Source/GTweak/Core/Services/ToolsetDownloadService.cs+++ b/.Source/GTweak/Core/Services/ToolsetDownloadService.cs@@ -26,7 +26,7 @@ namespace GTweak.Core.Services}internal static DownloadSession GetOrCreateSession(ToolsetModel model) => _sessions.GetOrAdd(!string.IsNullOrWhiteSpace(model.SourceUrl) ? model.SourceUrl : model.AppName, _ => new DownloadSession(model));-+internal static async Task<string> GetResolvedDownloadUrl(ToolsetModel model){try