mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-22 00:54:26 +08:00
settings_re6
This commit is contained in:
@@ -5,8 +5,7 @@
|
|||||||
<Style Selector="StackPanel.settings-page-container">
|
<Style Selector="StackPanel.settings-page-container">
|
||||||
<Setter Property="Spacing" Value="0" />
|
<Setter Property="Spacing" Value="0" />
|
||||||
<Setter Property="Margin" Value="0,12,0,24" />
|
<Setter Property="Margin" Value="0,12,0,24" />
|
||||||
<Setter Property="Width" Value="{DynamicResource SettingsPageContentWidth}" />
|
<Setter Property="MaxWidth" Value="{DynamicResource SettingsContainerMaxWidth}" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="TextBlock.settings-section-title">
|
<Style Selector="TextBlock.settings-section-title">
|
||||||
@@ -138,6 +137,20 @@
|
|||||||
<Setter Property="MinWidth" Value="0" />
|
<Setter Property="MinWidth" Value="0" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="ui|SettingsExpander ComboBox, ui|SettingsExpander TextBox, ui|SettingsExpander NumericUpDown">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="ui|SettingsExpanderItem ComboBox, ui|SettingsExpanderItem TextBox, ui|SettingsExpanderItem NumericUpDown">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="ui|SettingsExpander ToggleSwitch, ui|SettingsExpanderItem ToggleSwitch">
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="ui|SettingsExpander.settings-expander-card">
|
<Style Selector="ui|SettingsExpander.settings-expander-card">
|
||||||
<Setter Property="Margin" Value="0,0,0,14" />
|
<Setter Property="Margin" Value="0,0,0,14" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -57,7 +57,6 @@
|
|||||||
<TextBlock Text="{Binding AutoCheckUpdatesLabel}"
|
<TextBlock Text="{Binding AutoCheckUpdatesLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<ToggleSwitch Grid.Column="1"
|
<ToggleSwitch Grid.Column="1"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
IsChecked="{Binding AutoCheckUpdates}" />
|
IsChecked="{Binding AutoCheckUpdates}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:SettingsExpanderItem>
|
</ui:SettingsExpanderItem>
|
||||||
@@ -66,7 +65,6 @@
|
|||||||
<TextBlock Text="{Binding IncludePrereleaseUpdatesLabel}"
|
<TextBlock Text="{Binding IncludePrereleaseUpdatesLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<ToggleSwitch Grid.Column="1"
|
<ToggleSwitch Grid.Column="1"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
IsChecked="{Binding IncludePrereleaseUpdates}" />
|
IsChecked="{Binding IncludePrereleaseUpdates}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:SettingsExpanderItem>
|
</ui:SettingsExpanderItem>
|
||||||
@@ -75,8 +73,7 @@
|
|||||||
<TextBlock Text="{Binding UpdateChannelLabel}"
|
<TextBlock Text="{Binding UpdateChannelLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<ComboBox Grid.Column="1"
|
<ComboBox Grid.Column="1"
|
||||||
MinWidth="160"
|
Width="180"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
ItemsSource="{Binding UpdateChannels}"
|
ItemsSource="{Binding UpdateChannels}"
|
||||||
SelectedItem="{Binding SelectedUpdateChannel}">
|
SelectedItem="{Binding SelectedUpdateChannel}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<TextBox Watermark="#AABBCC"
|
<TextBox Watermark="#AABBCC"
|
||||||
MinWidth="160"
|
Width="180"
|
||||||
Text="{Binding ThemeColor}" />
|
Text="{Binding ThemeColor}" />
|
||||||
</ui:SettingsExpander.Footer>
|
</ui:SettingsExpander.Footer>
|
||||||
</ui:SettingsExpander>
|
</ui:SettingsExpander>
|
||||||
@@ -61,8 +61,7 @@
|
|||||||
<TextBlock Text="{Binding ClockFormatLabel}"
|
<TextBlock Text="{Binding ClockFormatLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<ComboBox Grid.Column="1"
|
<ComboBox Grid.Column="1"
|
||||||
MinWidth="160"
|
Width="180"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
ItemsSource="{Binding ClockFormats}"
|
ItemsSource="{Binding ClockFormats}"
|
||||||
SelectedItem="{Binding SelectedClockFormat}">
|
SelectedItem="{Binding SelectedClockFormat}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
|
|||||||
@@ -24,8 +24,7 @@
|
|||||||
<TextBlock Text="{Binding ShortSideCellsLabel}"
|
<TextBlock Text="{Binding ShortSideCellsLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<NumericUpDown Grid.Column="1"
|
<NumericUpDown Grid.Column="1"
|
||||||
MinWidth="120"
|
Width="120"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Minimum="6"
|
Minimum="6"
|
||||||
Maximum="96"
|
Maximum="96"
|
||||||
Value="{Binding ShortSideCells}" />
|
Value="{Binding ShortSideCells}" />
|
||||||
@@ -36,8 +35,7 @@
|
|||||||
<TextBlock Text="{Binding EdgeInsetPercentLabel}"
|
<TextBlock Text="{Binding EdgeInsetPercentLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<NumericUpDown Grid.Column="1"
|
<NumericUpDown Grid.Column="1"
|
||||||
MinWidth="120"
|
Width="120"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Minimum="0"
|
Minimum="0"
|
||||||
Maximum="30"
|
Maximum="30"
|
||||||
Value="{Binding EdgeInsetPercent}" />
|
Value="{Binding EdgeInsetPercent}" />
|
||||||
@@ -48,8 +46,7 @@
|
|||||||
<TextBlock Text="{Binding SpacingPresetLabel}"
|
<TextBlock Text="{Binding SpacingPresetLabel}"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
<ComboBox Grid.Column="1"
|
<ComboBox Grid.Column="1"
|
||||||
MinWidth="160"
|
Width="180"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
ItemsSource="{Binding SpacingPresets}"
|
ItemsSource="{Binding SpacingPresets}"
|
||||||
SelectedItem="{Binding SelectedSpacingPreset}">
|
SelectedItem="{Binding SelectedSpacingPreset}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<fi:SymbolIconSource Symbol="Settings" />
|
<fi:SymbolIconSource Symbol="Settings" />
|
||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<ComboBox MinWidth="240"
|
<ComboBox Width="220"
|
||||||
ItemsSource="{Binding Languages}"
|
ItemsSource="{Binding Languages}"
|
||||||
SelectedItem="{Binding SelectedLanguage}">
|
SelectedItem="{Binding SelectedLanguage}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<fi:SymbolIconSource Symbol="Clock" />
|
<fi:SymbolIconSource Symbol="Clock" />
|
||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<ComboBox MinWidth="280"
|
<ComboBox Width="240"
|
||||||
ItemsSource="{Binding TimeZones}"
|
ItemsSource="{Binding TimeZones}"
|
||||||
SelectedItem="{Binding SelectedTimeZone}">
|
SelectedItem="{Binding SelectedTimeZone}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
<fi:SymbolIconSource Symbol="DeveloperBoard" />
|
<fi:SymbolIconSource Symbol="DeveloperBoard" />
|
||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<ComboBox MinWidth="240"
|
<ComboBox Width="220"
|
||||||
ItemsSource="{Binding RenderModes}"
|
ItemsSource="{Binding RenderModes}"
|
||||||
SelectedItem="{Binding SelectedRenderMode}">
|
SelectedItem="{Binding SelectedRenderMode}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
|
|||||||
@@ -18,13 +18,15 @@
|
|||||||
<fi:SymbolIconSource Symbol="Image" />
|
<fi:SymbolIconSource Symbol="Image" />
|
||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<Grid ColumnDefinitions="220,Auto"
|
||||||
|
ColumnSpacing="8">
|
||||||
<TextBox IsReadOnly="True"
|
<TextBox IsReadOnly="True"
|
||||||
MinWidth="200"
|
Grid.Column="0"
|
||||||
Text="{Binding WallpaperPath}" />
|
Text="{Binding WallpaperPath}" />
|
||||||
<Button Click="OnBrowseWallpaperClick"
|
<Button Grid.Column="1"
|
||||||
|
Click="OnBrowseWallpaperClick"
|
||||||
Content="{Binding ImportWallpaperButtonText}" />
|
Content="{Binding ImportWallpaperButtonText}" />
|
||||||
</StackPanel>
|
</Grid>
|
||||||
</ui:SettingsExpander.Footer>
|
</ui:SettingsExpander.Footer>
|
||||||
</ui:SettingsExpander>
|
</ui:SettingsExpander>
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
<fi:SymbolIconSource Symbol="Maximize" />
|
<fi:SymbolIconSource Symbol="Maximize" />
|
||||||
</ui:SettingsExpander.IconSource>
|
</ui:SettingsExpander.IconSource>
|
||||||
<ui:SettingsExpander.Footer>
|
<ui:SettingsExpander.Footer>
|
||||||
<ComboBox MinWidth="160"
|
<ComboBox Width="180"
|
||||||
ItemsSource="{Binding WallpaperPlacements}"
|
ItemsSource="{Binding WallpaperPlacements}"
|
||||||
SelectedItem="{Binding SelectedWallpaperPlacement}">
|
SelectedItem="{Binding SelectedWallpaperPlacement}">
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
|
|||||||
@@ -18,14 +18,13 @@
|
|||||||
Title="{Binding Title}">
|
Title="{Binding Title}">
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<x:Double x:Key="SettingsPageContentWidth">920</x:Double>
|
<x:Double x:Key="SettingsContainerMaxWidth">960</x:Double>
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
|
|
||||||
<Window.Styles>
|
<Window.Styles>
|
||||||
<Style Selector="Grid.page-title-container">
|
<Style Selector="Grid.page-title-container">
|
||||||
<Setter Property="Margin" Value="0,16,0,0" />
|
<Setter Property="Margin" Value="0,16,0,0" />
|
||||||
<Setter Property="Width" Value="{DynamicResource SettingsPageContentWidth}" />
|
<Setter Property="MaxWidth" Value="{DynamicResource SettingsContainerMaxWidth}" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style Selector="TextBlock.page-title-text">
|
<Style Selector="TextBlock.page-title-text">
|
||||||
|
|||||||
@@ -18,17 +18,21 @@ namespace LanMountainDesktop.Views;
|
|||||||
|
|
||||||
public partial class SettingsWindow : Window, ISettingsPageHostContext
|
public partial class SettingsWindow : Window, ISettingsPageHostContext
|
||||||
{
|
{
|
||||||
private const double BaseSettingsContentWidth = 960d;
|
private const double BaseSettingsContainerWidth = 960d;
|
||||||
private const double MinSettingsContentWidth = 320d;
|
private const double MinSettingsContentWidth = 320d;
|
||||||
private const double MaxSettingsContentWidth = 1280d;
|
private const double MinSettingsContainerWidth = 840d;
|
||||||
|
private const double MaxSettingsContainerWidth = 1160d;
|
||||||
private const double BaseDrawerWidth = 296d;
|
private const double BaseDrawerWidth = 296d;
|
||||||
|
private const double BasePaneOpenLength = 283d;
|
||||||
|
private const double MinPaneOpenLength = 260d;
|
||||||
|
private const double MaxPaneOpenLength = 288d;
|
||||||
private const double BaseNarrowThreshold = 800d;
|
private const double BaseNarrowThreshold = 800d;
|
||||||
|
|
||||||
private readonly ISettingsPageRegistry _pageRegistry;
|
private readonly ISettingsPageRegistry _pageRegistry;
|
||||||
private readonly IHostApplicationLifecycle _hostApplicationLifecycle;
|
private readonly IHostApplicationLifecycle _hostApplicationLifecycle;
|
||||||
private readonly Dictionary<string, Control> _cachedPages = new(StringComparer.OrdinalIgnoreCase);
|
private readonly Dictionary<string, Control> _cachedPages = new(StringComparer.OrdinalIgnoreCase);
|
||||||
private readonly bool _useSystemChrome;
|
private readonly bool _useSystemChrome;
|
||||||
private bool _isResponsiveLayoutRefreshPending;
|
private bool _isResponsiveRefreshPending;
|
||||||
|
|
||||||
public SettingsWindow()
|
public SettingsWindow()
|
||||||
: this(
|
: this(
|
||||||
@@ -326,27 +330,26 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
|
|
||||||
var width = Bounds.Width > 1 ? Bounds.Width : Math.Max(Width, MinWidth);
|
var width = Bounds.Width > 1 ? Bounds.Width : Math.Max(Width, MinWidth);
|
||||||
var renderScale = RenderScaling > 0 ? RenderScaling : 1d;
|
var renderScale = RenderScaling > 0 ? RenderScaling : 1d;
|
||||||
var titleScale = WindowTitleTextBlock?.FontSize > 0
|
var contentScale = GetContentScale();
|
||||||
? WindowTitleTextBlock.FontSize / 12d
|
|
||||||
: 1d;
|
|
||||||
var pageTitleScale = PageTitleTextBlock?.FontSize > 0
|
|
||||||
? PageTitleTextBlock.FontSize / 28d
|
|
||||||
: 1d;
|
|
||||||
var typographyScale = Math.Max(titleScale, pageTitleScale);
|
|
||||||
var contentScale = Math.Clamp(
|
|
||||||
1d + ((renderScale - 1d) * 0.7d) + ((typographyScale - 1d) * 0.45d),
|
|
||||||
1d,
|
|
||||||
1.45d);
|
|
||||||
|
|
||||||
var horizontalMargin = Math.Clamp(16d * renderScale, 12d, 32d);
|
var horizontalMargin = Math.Clamp(16d * renderScale, 12d, 24d);
|
||||||
var topMargin = Math.Clamp(2d * renderScale, 0d, 8d);
|
var topMargin = Math.Clamp(2d * renderScale, 0d, 8d);
|
||||||
var bottomMargin = Math.Clamp(16d * renderScale, 12d, 28d);
|
var bottomMargin = Math.Clamp(16d * renderScale, 12d, 28d);
|
||||||
var columnSpacing = Math.Clamp(20d * renderScale, 12d, 28d);
|
var columnSpacing = Math.Clamp(20d * renderScale, 16d, 28d);
|
||||||
|
var edgePadding = Math.Clamp(20d * renderScale, 12d, 28d);
|
||||||
var drawerWidth = Math.Clamp(BaseDrawerWidth * contentScale, 276d, 380d);
|
var drawerWidth = Math.Clamp(BaseDrawerWidth * contentScale, 276d, 380d);
|
||||||
var compactPaneWidth = Math.Clamp(48d * renderScale, 40d, 60d);
|
var compactPaneWidth = Math.Clamp(48d * renderScale, 40d, 60d);
|
||||||
var narrowThreshold = Math.Clamp(BaseNarrowThreshold * renderScale, 760d, 980d);
|
var narrowThreshold = Math.Clamp(BaseNarrowThreshold * renderScale, 760d, 980d);
|
||||||
var isNarrow = width < narrowThreshold;
|
var isNarrow = width < narrowThreshold;
|
||||||
var paneReservedWidth = GetReservedPaneWidth(compactPaneWidth, isNarrow);
|
var paneOpenWidth = ComputePaneOpenLength();
|
||||||
|
var paneReservedWidth = GetReservedPaneWidth(compactPaneWidth, isNarrow, paneOpenWidth);
|
||||||
|
var containerMaxWidth = ComputeSettingsContainerMaxWidth();
|
||||||
|
|
||||||
|
if (RootNavigationView is not null &&
|
||||||
|
Math.Abs(RootNavigationView.OpenPaneLength - paneOpenWidth) > 0.5d)
|
||||||
|
{
|
||||||
|
RootNavigationView.OpenPaneLength = paneOpenWidth;
|
||||||
|
}
|
||||||
|
|
||||||
SettingsContentGrid.Margin = new Thickness(horizontalMargin, topMargin, horizontalMargin, bottomMargin);
|
SettingsContentGrid.Margin = new Thickness(horizontalMargin, topMargin, horizontalMargin, bottomMargin);
|
||||||
DrawerBorder.Width = drawerWidth;
|
DrawerBorder.Width = drawerWidth;
|
||||||
@@ -359,8 +362,6 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
{
|
{
|
||||||
ViewModel.IsDrawerOpen = false;
|
ViewModel.IsDrawerOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawerBorder.IsVisible = false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -368,33 +369,14 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
SettingsContentGrid.ColumnSpacing = columnSpacing;
|
SettingsContentGrid.ColumnSpacing = columnSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
var contentHostWidth = ContentFrame?.Bounds.Width > 1
|
var rootContentWidth = RootNavigationView?.Bounds.Width > 1
|
||||||
? ContentFrame.Bounds.Width
|
? RootNavigationView.Bounds.Width - paneReservedWidth
|
||||||
: 0d;
|
: Math.Max(SettingsContentGrid.Bounds.Width, width - horizontalMargin * 2d - paneReservedWidth);
|
||||||
if (contentHostWidth <= 1)
|
var contentHostWidth = rootContentWidth - (isNarrow ? 0d : drawerWidth + SettingsContentGrid.ColumnSpacing);
|
||||||
{
|
|
||||||
var rootContentWidth = RootNavigationView?.Bounds.Width > 1
|
|
||||||
? RootNavigationView.Bounds.Width - paneReservedWidth
|
|
||||||
: SettingsContentGrid.Bounds.Width;
|
|
||||||
contentHostWidth = rootContentWidth - (isNarrow ? 0d : drawerWidth + SettingsContentGrid.ColumnSpacing);
|
|
||||||
}
|
|
||||||
|
|
||||||
contentHostWidth = Math.Max(MinSettingsContentWidth, contentHostWidth);
|
|
||||||
|
|
||||||
var edgePadding = Math.Clamp(24d * renderScale, 14d, 40d);
|
|
||||||
var preferredContentWidth = Math.Clamp(BaseSettingsContentWidth * contentScale, 820d, MaxSettingsContentWidth);
|
|
||||||
var availableContentWidth = Math.Max(MinSettingsContentWidth, contentHostWidth - edgePadding * 2d);
|
var availableContentWidth = Math.Max(MinSettingsContentWidth, contentHostWidth - edgePadding * 2d);
|
||||||
var resolvedContentWidth = availableContentWidth > preferredContentWidth
|
var resolvedContentWidth = Math.Min(containerMaxWidth, availableContentWidth);
|
||||||
? preferredContentWidth
|
|
||||||
: availableContentWidth;
|
|
||||||
|
|
||||||
Resources["SettingsPageContentWidth"] = resolvedContentWidth;
|
Resources["SettingsContainerMaxWidth"] = containerMaxWidth;
|
||||||
|
|
||||||
if (PageTitleContainer is not null)
|
|
||||||
{
|
|
||||||
PageTitleContainer.Width = resolvedContentWidth;
|
|
||||||
PageTitleContainer.HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PageTitleTextBlock is not null)
|
if (PageTitleTextBlock is not null)
|
||||||
{
|
{
|
||||||
@@ -408,34 +390,8 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
private void UpdateResponsiveLayout()
|
private void UpdateResponsiveLayout()
|
||||||
{
|
{
|
||||||
_ = TryApplyResponsiveLayout();
|
_ = TryApplyResponsiveLayout();
|
||||||
return;
|
|
||||||
|
|
||||||
if (SettingsContentGrid is null || DrawerBorder is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var width = Bounds.Width;
|
|
||||||
const double narrowThreshold = 800;
|
|
||||||
|
|
||||||
var isNarrow = width < narrowThreshold;
|
|
||||||
|
|
||||||
// 小窗口时隐藏抽屉面板
|
// 小窗口时隐藏抽屉面板
|
||||||
if (isNarrow)
|
|
||||||
{
|
|
||||||
SettingsContentGrid.ColumnDefinitions = new ColumnDefinitions("*");
|
|
||||||
SettingsContentGrid.ColumnSpacing = 0;
|
|
||||||
if (DrawerBorder.IsVisible)
|
|
||||||
{
|
|
||||||
ViewModel.IsDrawerOpen = false;
|
|
||||||
}
|
|
||||||
DrawerBorder.IsVisible = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SettingsContentGrid.ColumnDefinitions = new ColumnDefinitions("*,Auto");
|
|
||||||
SettingsContentGrid.ColumnSpacing = 20;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClosed(object? sender, EventArgs e)
|
private void OnClosed(object? sender, EventArgs e)
|
||||||
@@ -496,20 +452,22 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
|
|
||||||
private void RequestResponsiveLayoutRefresh()
|
private void RequestResponsiveLayoutRefresh()
|
||||||
{
|
{
|
||||||
if (_isResponsiveLayoutRefreshPending)
|
if (_isResponsiveRefreshPending)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_isResponsiveLayoutRefreshPending = true;
|
_isResponsiveRefreshPending = true;
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Post(
|
||||||
{
|
() =>
|
||||||
_isResponsiveLayoutRefreshPending = false;
|
{
|
||||||
UpdateResponsiveLayout();
|
_isResponsiveRefreshPending = false;
|
||||||
}, DispatcherPriority.Background);
|
UpdateResponsiveLayout();
|
||||||
|
},
|
||||||
|
DispatcherPriority.Loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double GetReservedPaneWidth(double compactPaneWidth, bool isNarrow)
|
private double GetReservedPaneWidth(double compactPaneWidth, bool isNarrow, double openPaneWidth)
|
||||||
{
|
{
|
||||||
if (RootNavigationView is null || isNarrow)
|
if (RootNavigationView is null || isNarrow)
|
||||||
{
|
{
|
||||||
@@ -517,7 +475,7 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
return RootNavigationView.IsPaneOpen
|
return RootNavigationView.IsPaneOpen
|
||||||
? RootNavigationView.OpenPaneLength
|
? openPaneWidth
|
||||||
: compactPaneWidth;
|
: compactPaneWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,8 +557,36 @@ public partial class SettingsWindow : Window, ISettingsPageHostContext
|
|||||||
CloseWindowButtonIcon.FontSize = titleBarIconSize;
|
CloseWindowButtonIcon.FontSize = titleBarIconSize;
|
||||||
|
|
||||||
DrawerTitleTextBlock.FontSize = drawerTitleFontSize;
|
DrawerTitleTextBlock.FontSize = drawerTitleFontSize;
|
||||||
|
}
|
||||||
|
|
||||||
RootNavigationView.OpenPaneLength = Math.Clamp(283d * layoutScale, 248d, 320d);
|
private double GetContentScale()
|
||||||
|
{
|
||||||
|
var renderScale = RenderScaling > 0 ? RenderScaling : 1d;
|
||||||
|
var titleScale = WindowTitleTextBlock?.FontSize > 0
|
||||||
|
? WindowTitleTextBlock.FontSize / 12d
|
||||||
|
: 1d;
|
||||||
|
var pageTitleScale = PageTitleTextBlock?.FontSize > 0
|
||||||
|
? PageTitleTextBlock.FontSize / 28d
|
||||||
|
: 1d;
|
||||||
|
var typographyScale = Math.Max(titleScale, pageTitleScale);
|
||||||
|
|
||||||
|
return Math.Clamp(
|
||||||
|
1d + ((renderScale - 1d) * 0.65d) + ((typographyScale - 1d) * 0.35d),
|
||||||
|
1d,
|
||||||
|
1.18d);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double ComputePaneOpenLength()
|
||||||
|
{
|
||||||
|
return Math.Clamp(BasePaneOpenLength * GetContentScale(), MinPaneOpenLength, MaxPaneOpenLength);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double ComputeSettingsContainerMaxWidth()
|
||||||
|
{
|
||||||
|
return Math.Clamp(
|
||||||
|
BaseSettingsContainerWidth * GetContentScale(),
|
||||||
|
MinSettingsContainerWidth,
|
||||||
|
MaxSettingsContainerWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SyncTitleText()
|
private void SyncTitleText()
|
||||||
|
|||||||
Reference in New Issue
Block a user