mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-20 23:54:26 +08:00
0.1.7
This commit is contained in:
@@ -74,8 +74,13 @@
|
||||
"filepicker.video_files": "Video files",
|
||||
"common.day": "Day",
|
||||
"common.night": "Night",
|
||||
"common.close": "Close",
|
||||
"common.recommended": "Recommended",
|
||||
"common.monet": "Monet",
|
||||
"button.component_library": "Component Library",
|
||||
"tooltip.component_library": "Component Library",
|
||||
"component_library.title": "Component Library",
|
||||
"component_library.empty": "No components yet. Components will appear here later.",
|
||||
"placement.fill": "Fill",
|
||||
"placement.fit": "Fit",
|
||||
"placement.stretch": "Stretch",
|
||||
|
||||
@@ -58,6 +58,14 @@ public partial class MainWindow
|
||||
BackToWindowsTextBlock.Text = L("button.back_to_windows", "Back to Windows");
|
||||
WallpaperPreviewBackButtonTextBlock.Text = L("button.back_to_windows", "Back to Windows");
|
||||
ToolTip.SetTip(BackToWindowsButton, L("tooltip.back_to_windows", "Back to Windows"));
|
||||
OpenComponentLibraryTextBlock.Text = L("button.component_library", "组件库");
|
||||
WallpaperPreviewComponentLibraryTextBlock.Text = L("button.component_library", "组件库");
|
||||
ToolTip.SetTip(OpenComponentLibraryButton, L("tooltip.component_library", "组件库"));
|
||||
ComponentLibraryTitleTextBlock.Text = L("component_library.title", "组件库");
|
||||
ToolTip.SetTip(CloseComponentLibraryButton, L("common.close", "关闭"));
|
||||
ComponentLibraryEmptyTextBlock.Text = L(
|
||||
"component_library.empty",
|
||||
"暂无组件,后续将在这里显示。");
|
||||
|
||||
SettingsTitleTextBlock.Text = L("settings.title", "Settings");
|
||||
SettingsNavHeaderTextBlock.Text = L("settings.nav_header", "Settings");
|
||||
|
||||
@@ -24,6 +24,11 @@ public partial class MainWindow
|
||||
{
|
||||
private void OnOpenSettingsClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isComponentLibraryOpen)
|
||||
{
|
||||
CloseComponentLibraryWindow(reopenSettings: false);
|
||||
}
|
||||
|
||||
if (_isSettingsOpen)
|
||||
{
|
||||
CloseSettingsPage();
|
||||
@@ -33,6 +38,27 @@ public partial class MainWindow
|
||||
OpenSettingsPage();
|
||||
}
|
||||
|
||||
private void OnOpenComponentLibraryClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_isComponentLibraryOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_reopenSettingsAfterComponentLibraryClose = _isSettingsOpen;
|
||||
if (_isSettingsOpen)
|
||||
{
|
||||
CloseSettingsPage(immediate: true);
|
||||
}
|
||||
|
||||
OpenComponentLibraryWindow();
|
||||
}
|
||||
|
||||
private void OnCloseComponentLibraryClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
CloseComponentLibraryWindow(reopenSettings: true);
|
||||
}
|
||||
|
||||
private void OnCloseSettingsClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
CloseSettingsPage();
|
||||
@@ -701,8 +727,10 @@ public partial class MainWindow
|
||||
private void ApplyTaskbarActionVisibility(TaskbarContext context)
|
||||
{
|
||||
if (BackToWindowsButton is null ||
|
||||
OpenComponentLibraryButton is null ||
|
||||
OpenSettingsButton is null ||
|
||||
WallpaperPreviewBackButtonVisual is null ||
|
||||
WallpaperPreviewComponentLibraryVisual is null ||
|
||||
WallpaperPreviewSettingsButtonIcon is null)
|
||||
{
|
||||
return;
|
||||
@@ -710,10 +738,13 @@ public partial class MainWindow
|
||||
|
||||
var showMinimize = _pinnedTaskbarActions.Contains(TaskbarActionId.MinimizeToWindows);
|
||||
var showSettings = _pinnedTaskbarActions.Contains(TaskbarActionId.OpenSettings);
|
||||
var showComponentLibrary = _isSettingsOpen || _isComponentLibraryOpen;
|
||||
|
||||
BackToWindowsButton.IsVisible = showMinimize;
|
||||
OpenComponentLibraryButton.IsVisible = showComponentLibrary;
|
||||
OpenSettingsButton.IsVisible = showSettings;
|
||||
WallpaperPreviewBackButtonVisual.IsVisible = showMinimize;
|
||||
WallpaperPreviewComponentLibraryVisual.IsVisible = showComponentLibrary;
|
||||
WallpaperPreviewSettingsButtonIcon.IsVisible = showSettings;
|
||||
|
||||
if (TaskbarFixedActionsHost is not null)
|
||||
@@ -723,7 +754,7 @@ public partial class MainWindow
|
||||
|
||||
if (TaskbarSettingsActionHost is not null)
|
||||
{
|
||||
TaskbarSettingsActionHost.IsVisible = showSettings;
|
||||
TaskbarSettingsActionHost.IsVisible = showSettings || showComponentLibrary;
|
||||
}
|
||||
|
||||
if (WallpaperPreviewTaskbarFixedActionsHost is not null)
|
||||
@@ -733,7 +764,7 @@ public partial class MainWindow
|
||||
|
||||
if (WallpaperPreviewTaskbarSettingsActionHost is not null)
|
||||
{
|
||||
WallpaperPreviewTaskbarSettingsActionHost.IsVisible = showSettings;
|
||||
WallpaperPreviewTaskbarSettingsActionHost.IsVisible = showSettings || showComponentLibrary;
|
||||
}
|
||||
|
||||
var dynamicActions = ResolveDynamicTaskbarActions(context);
|
||||
@@ -775,6 +806,58 @@ public partial class MainWindow
|
||||
ApplyWidgetSizing(effectiveCellSize);
|
||||
}
|
||||
|
||||
private void OpenComponentLibraryWindow()
|
||||
{
|
||||
if (ComponentLibraryWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isComponentLibraryOpen = true;
|
||||
ComponentLibraryWindow.IsVisible = true;
|
||||
ComponentLibraryWindow.Opacity = 0;
|
||||
ApplyTaskbarActionVisibility(GetCurrentTaskbarContext());
|
||||
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
if (!_isComponentLibraryOpen || ComponentLibraryWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ComponentLibraryWindow.Opacity = 1;
|
||||
}, DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
private void CloseComponentLibraryWindow(bool reopenSettings)
|
||||
{
|
||||
if (!_isComponentLibraryOpen || ComponentLibraryWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isComponentLibraryOpen = false;
|
||||
ComponentLibraryWindow.Opacity = 0;
|
||||
ApplyTaskbarActionVisibility(GetCurrentTaskbarContext());
|
||||
|
||||
DispatcherTimer.RunOnce(() =>
|
||||
{
|
||||
if (_isComponentLibraryOpen || ComponentLibraryWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ComponentLibraryWindow.IsVisible = false;
|
||||
|
||||
var shouldReopenSettings = reopenSettings && _reopenSettingsAfterComponentLibraryClose;
|
||||
_reopenSettingsAfterComponentLibraryClose = false;
|
||||
if (shouldReopenSettings)
|
||||
{
|
||||
OpenSettingsPage();
|
||||
}
|
||||
}, TimeSpan.FromMilliseconds(200));
|
||||
}
|
||||
|
||||
private IReadOnlyList<TaskbarActionItem> ResolveDynamicTaskbarActions(TaskbarContext context)
|
||||
{
|
||||
if (!_enableDynamicTaskbarActions)
|
||||
@@ -1182,6 +1265,11 @@ public partial class MainWindow
|
||||
|
||||
private void OpenSettingsPage()
|
||||
{
|
||||
if (_isComponentLibraryOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isSettingsOpen)
|
||||
{
|
||||
return;
|
||||
@@ -1207,7 +1295,7 @@ public partial class MainWindow
|
||||
}, DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
private void CloseSettingsPage()
|
||||
private void CloseSettingsPage(bool immediate = false)
|
||||
{
|
||||
if (!_isSettingsOpen)
|
||||
{
|
||||
@@ -1219,6 +1307,13 @@ public partial class MainWindow
|
||||
ApplyWallpaperBrush();
|
||||
ApplyTaskbarActionVisibility(GetCurrentTaskbarContext());
|
||||
|
||||
if (immediate)
|
||||
{
|
||||
SettingsPage.Opacity = 0;
|
||||
SettingsPage.IsVisible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsPage.Opacity = 0;
|
||||
|
||||
DispatcherTimer.RunOnce(() =>
|
||||
|
||||
@@ -162,28 +162,56 @@
|
||||
Grid.Column="2"
|
||||
Background="Transparent"
|
||||
BorderThickness="0">
|
||||
<Button x:Name="OpenSettingsButton"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Click="OnOpenSettingsClick"
|
||||
ToolTip.Tip="设置">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="6">
|
||||
<fi:SymbolIcon Classes="icon-l"
|
||||
Symbol="Settings"
|
||||
IconVariant="Regular" />
|
||||
<TextBlock x:Name="OpenSettingsButtonTextBlock"
|
||||
IsVisible="False"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="返回桌面" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Grid ColumnDefinitions="Auto,Auto"
|
||||
ColumnSpacing="8">
|
||||
<Button x:Name="OpenComponentLibraryButton"
|
||||
Grid.Column="0"
|
||||
IsVisible="False"
|
||||
Padding="8"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Click="OnOpenComponentLibraryClick"
|
||||
ToolTip.Tip="组件库">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="8">
|
||||
<fi:FluentIcon Classes="icon-m"
|
||||
Icon="Apps"
|
||||
IconVariant="Regular" />
|
||||
<TextBlock x:Name="OpenComponentLibraryTextBlock"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="组件库" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="OpenSettingsButton"
|
||||
Grid.Column="1"
|
||||
Padding="6"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Click="OnOpenSettingsClick"
|
||||
ToolTip.Tip="设置">
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="6">
|
||||
<fi:SymbolIcon Classes="icon-l"
|
||||
Symbol="Settings"
|
||||
IconVariant="Regular" />
|
||||
<TextBlock x:Name="OpenSettingsButtonTextBlock"
|
||||
IsVisible="False"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="返回桌面" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -377,8 +405,8 @@
|
||||
<TextBlock x:Name="WallpaperPreviewBackButtonTextBlock"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="回到Windows" />
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="回到Windows" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
@@ -398,10 +426,30 @@
|
||||
Grid.Column="2"
|
||||
Background="Transparent"
|
||||
BorderThickness="0">
|
||||
<fi:SymbolIcon x:Name="WallpaperPreviewSettingsButtonIcon"
|
||||
Classes="icon-s"
|
||||
Symbol="Settings"
|
||||
IconVariant="Regular" />
|
||||
<Grid ColumnDefinitions="Auto,Auto"
|
||||
ColumnSpacing="3">
|
||||
<StackPanel x:Name="WallpaperPreviewComponentLibraryVisual"
|
||||
Grid.Column="0"
|
||||
IsVisible="False"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Spacing="3">
|
||||
<fi:FluentIcon Classes="icon-s"
|
||||
Icon="Apps"
|
||||
IconVariant="Regular" />
|
||||
<TextBlock x:Name="WallpaperPreviewComponentLibraryTextBlock"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="组件库" />
|
||||
</StackPanel>
|
||||
<fi:SymbolIcon x:Name="WallpaperPreviewSettingsButtonIcon"
|
||||
Grid.Column="1"
|
||||
Classes="icon-s"
|
||||
Symbol="Settings"
|
||||
IconVariant="Regular" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -776,6 +824,63 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Border x:Name="ComponentLibraryWindow"
|
||||
IsVisible="False"
|
||||
Opacity="0"
|
||||
Classes="glass-strong"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Bottom"
|
||||
Width="520"
|
||||
MinWidth="360"
|
||||
MaxWidth="720"
|
||||
Height="260"
|
||||
MinHeight="220"
|
||||
Margin="24,24,24,100"
|
||||
CornerRadius="18"
|
||||
Padding="14">
|
||||
<Border.Transitions>
|
||||
<Transitions>
|
||||
<DoubleTransition Property="Opacity" Duration="0:0:0.2" />
|
||||
</Transitions>
|
||||
</Border.Transitions>
|
||||
|
||||
<Grid RowDefinitions="Auto,*"
|
||||
RowSpacing="10">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock x:Name="ComponentLibraryTitleTextBlock"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Text="组件库" />
|
||||
<Button x:Name="CloseComponentLibraryButton"
|
||||
Grid.Column="1"
|
||||
Padding="8"
|
||||
Width="32"
|
||||
Height="32"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
|
||||
Click="OnCloseComponentLibraryClick">
|
||||
<fi:SymbolIcon Classes="icon-s"
|
||||
Symbol="Dismiss"
|
||||
IconVariant="Regular" />
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Classes="glass-panel"
|
||||
CornerRadius="12"
|
||||
Padding="14">
|
||||
<TextBlock x:Name="ComponentLibraryEmptyTextBlock"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{DynamicResource AdaptiveTextSecondaryBrush}"
|
||||
Text="暂无组件,后续将在这里显示。" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -76,6 +76,8 @@ public partial class MainWindow : Window
|
||||
private bool _suppressLanguageSelectionEvents;
|
||||
private bool _suppressSettingsPersistence;
|
||||
private bool _isUpdatingWallpaperPreviewLayout;
|
||||
private bool _isComponentLibraryOpen;
|
||||
private bool _reopenSettingsAfterComponentLibraryClose;
|
||||
private TranslateTransform? _settingsContentPanelTransform;
|
||||
private IBrush? _defaultDesktopBackground;
|
||||
private Bitmap? _wallpaperBitmap;
|
||||
@@ -327,6 +329,11 @@ public partial class MainWindow : Window
|
||||
BackToWindowsButton.FontSize = Math.Clamp(cellSize * 0.22, 8, 22);
|
||||
BackToWindowsButton.MinHeight = taskbarCell;
|
||||
BackToWindowsButton.MinWidth = Math.Clamp(cellSize * 2.3, 90, 320);
|
||||
OpenComponentLibraryButton.Margin = new Thickness(0);
|
||||
OpenComponentLibraryButton.Padding = new Thickness(horizontalPadding, verticalPadding);
|
||||
OpenComponentLibraryButton.FontSize = Math.Clamp(cellSize * 0.22, 8, 22);
|
||||
OpenComponentLibraryButton.MinHeight = taskbarCell;
|
||||
OpenComponentLibraryButton.MinWidth = Math.Clamp(cellSize * 2.0, 88, 300);
|
||||
|
||||
OpenSettingsButton.Margin = new Thickness(0);
|
||||
OpenSettingsButton.Height = taskbarCell;
|
||||
@@ -344,6 +351,23 @@ public partial class MainWindow : Window
|
||||
OpenSettingsButton.MinWidth = taskbarCell;
|
||||
OpenSettingsButton.Padding = new Thickness(Math.Clamp(taskbarCell * 0.2, 4, 12));
|
||||
}
|
||||
|
||||
UpdateComponentLibraryLayout(cellSize);
|
||||
}
|
||||
|
||||
private void UpdateComponentLibraryLayout(double cellSize)
|
||||
{
|
||||
if (ComponentLibraryWindow is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var horizontalMargin = Math.Clamp(cellSize * 0.7, 18, 44);
|
||||
var bottomMargin = Math.Clamp(cellSize * 1.4, 56, 190);
|
||||
ComponentLibraryWindow.Margin = new Thickness(horizontalMargin, 20, horizontalMargin, bottomMargin);
|
||||
ComponentLibraryWindow.CornerRadius = new CornerRadius(Math.Clamp(cellSize * 0.24, 12, 24));
|
||||
ComponentLibraryWindow.Height = Math.Clamp(cellSize * 4.8, 220, 360);
|
||||
ComponentLibraryWindow.Width = Math.Clamp(cellSize * 9.2, 360, 760);
|
||||
}
|
||||
|
||||
private void UpdateSettingsViewportInsets(double cellSize)
|
||||
@@ -473,8 +497,11 @@ public partial class MainWindow : Window
|
||||
|
||||
WallpaperPreviewClockTextBlock.FontSize = Math.Clamp(cellSize * 0.30, 6, 18);
|
||||
WallpaperPreviewBackButtonTextBlock.FontSize = Math.Clamp(cellSize * 0.19, 5, 13);
|
||||
WallpaperPreviewComponentLibraryTextBlock.FontSize = Math.Clamp(cellSize * 0.18, 5, 12);
|
||||
WallpaperPreviewBackButtonVisual.MinHeight = previewTaskbarCell;
|
||||
WallpaperPreviewBackButtonVisual.MinWidth = Math.Clamp(cellSize * 2.1, 30, 120);
|
||||
WallpaperPreviewComponentLibraryVisual.MinHeight = previewTaskbarCell;
|
||||
WallpaperPreviewComponentLibraryVisual.MinWidth = Math.Clamp(cellSize * 2.0, 28, 110);
|
||||
WallpaperPreviewSettingsButtonIcon.Width = Math.Clamp(previewTaskbarCell * 0.42, 6, 14);
|
||||
WallpaperPreviewSettingsButtonIcon.Height = Math.Clamp(previewTaskbarCell * 0.42, 6, 14);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user