Files
LanMountainDesktop/LanMountainDesktop/Views/MainWindow.axaml
2026-04-03 11:42:00 +08:00

614 lines
36 KiB
XML

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:LanMountainDesktop.ViewModels"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:fi="using:FluentIcons.Avalonia"
xmlns:ic="using:FluentIcons.Avalonia.Fluent"
xmlns:mi="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:comp="using:LanMountainDesktop.Views.Components"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignWidth="1280"
d:DesignHeight="720"
x:Class="LanMountainDesktop.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
WindowState="FullScreen"
SystemDecorations="None"
CanResize="False"
UseLayoutRounding="True"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
Background="Transparent"
Title="LanMountainDesktop">
<Design.DataContext>
<vm:MainWindowViewModel />
</Design.DataContext>
<Window.Styles>
<Style Selector="Border.taskbar-profile-popup-panel">
<Setter Property="Background" Value="{DynamicResource TaskbarProfilePopupSurfaceBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource TaskbarProfilePopupOutlineBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="26" />
<Setter Property="Padding" Value="16" />
<Setter Property="BoxShadow" Value="0 14 36 #2A000000" />
</Style>
<Style Selector="Border.taskbar-profile-popup-avatar">
<Setter Property="Background" Value="{DynamicResource TaskbarProfilePopupAvatarSurfaceBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource TaskbarProfilePopupOutlineBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="22" />
</Style>
<Style Selector="TextBlock.taskbar-profile-popup-primary">
<Setter Property="Foreground" Value="{DynamicResource TaskbarProfilePopupTextBrush}" />
</Style>
<Style Selector="TextBlock.taskbar-profile-popup-title">
<Setter Property="Foreground" Value="{DynamicResource TaskbarProfilePopupTextBrush}" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>
<Style Selector="TextBlock.taskbar-profile-popup-action-text">
<Setter Property="Foreground" Value="{DynamicResource TaskbarProfilePopupTextBrush}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="mi|MaterialIcon.taskbar-profile-popup-action-icon">
<Setter Property="Foreground" Value="{DynamicResource TaskbarProfilePopupAccentBrush}" />
<Setter Property="Width" Value="20" />
<Setter Property="Height" Value="20" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="Button.taskbar-profile-popup-action">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="CornerRadius" Value="18" />
<Setter Property="Padding" Value="14,12" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="Transitions">
<Transitions>
<BrushTransition Property="Background" Duration="{StaticResource FluttermotionToken.Duration.Fast}" />
<TransformOperationsTransition Property="RenderTransform" Duration="{StaticResource FluttermotionToken.Duration.Fast}" />
</Transitions>
</Setter>
</Style>
<Style Selector="Button.taskbar-profile-popup-action:pointerover">
<Setter Property="Background" Value="{DynamicResource TaskbarProfilePopupActionHoverBrush}" />
<Setter Property="RenderTransform" Value="scale(1.01)" />
</Style>
<Style Selector="Button.taskbar-profile-popup-action:pressed">
<Setter Property="Background" Value="{DynamicResource TaskbarProfilePopupActionPressedBrush}" />
<Setter Property="RenderTransform" Value="scale(0.985)" />
</Style>
</Window.Styles>
<Grid>
<Grid x:Name="DesktopPage"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="{StaticResource FluttermotionToken.Duration.Page}" />
</Transitions>
</Grid.Transitions>
<Border x:Name="DesktopHost"
ClipToBounds="True"
Background="Transparent"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid>
<Border x:Name="DesktopWallpaperLayer"
IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="#FFF6F7F9" />
<Border x:Name="DesktopWallpaperImageLayer"
IsVisible="False"
IsHitTestVisible="False"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent" />
<Grid x:Name="DesktopGrid"
HorizontalAlignment="Center"
VerticalAlignment="Center"
ShowGridLines="False">
<Border x:Name="DesktopPagesViewport"
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="1"
Background="Transparent"
ClipToBounds="True"
BorderThickness="0"
PointerWheelChanged="OnDesktopPagesPointerWheelChanged">
<Grid>
<Grid x:Name="DesktopPagesHost"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Grid.RenderTransform>
<TranslateTransform>
<TranslateTransform.Transitions>
<Transitions>
<DoubleTransition Property="X"
Duration="{StaticResource FluttermotionToken.Duration.Page}"
Easing="0.22,1,0.36,1" />
</Transitions>
</TranslateTransform.Transitions>
</TranslateTransform>
</Grid.RenderTransform>
<Grid x:Name="DesktopPagesContainer"
Grid.Column="0" />
<Border x:Name="LauncherPagePanel"
Grid.Column="1"
Classes="surface-translucent-panel"
ClipToBounds="False"
CornerRadius="36"
Padding="18">
<Grid RowDefinitions="Auto,*">
<StackPanel Spacing="4">
<TextBlock x:Name="LauncherTitleTextBlock"
FontSize="24"
FontWeight="SemiBold" />
<TextBlock x:Name="LauncherSubtitleTextBlock"
Foreground="{DynamicResource AdaptiveTextSecondaryBrush}" />
</StackPanel>
<Grid Grid.Row="1"
Margin="0,12,0,0">
<ScrollViewer x:Name="LauncherRootScrollViewer"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<WrapPanel x:Name="LauncherRootTilePanel"
Orientation="Horizontal" />
</ScrollViewer>
<Grid x:Name="LauncherFolderOverlay"
IsVisible="False"
Background="{DynamicResource AdaptiveGlassOverlayBackgroundBrush}"
Opacity="{DynamicResource AdaptiveGlassOverlayOpacity}"
PointerPressed="OnLauncherFolderOverlayPointerPressed">
<Border x:Name="LauncherFolderPanel"
Classes="surface-solid-strong"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="464"
Height="384"
CornerRadius="24"
Padding="16,14,16,12">
<Grid RowDefinitions="Auto,*">
<TextBlock x:Name="LauncherFolderTitleTextBlock"
FontSize="15"
FontWeight="SemiBold"
HorizontalAlignment="Center"
Margin="0,0,0,10" />
<Grid x:Name="LauncherFolderGridPanel"
Grid.Row="1"
ColumnDefinitions="*,*,*,*"
RowDefinitions="*,*,*" />
</Grid>
</Border>
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
<Canvas x:Name="DesktopEditDragLayer"
IsHitTestVisible="False" />
<Canvas x:Name="ComponentPreviewStagingHost"
Width="1"
Height="1"
Opacity="0"
ClipToBounds="True"
HorizontalAlignment="Left"
VerticalAlignment="Top"
IsHitTestVisible="False" />
</Grid>
</Border>
<Border x:Name="TopStatusBarHost"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="1"
Background="Transparent"
BorderThickness="0"
Padding="4">
<StackPanel x:Name="TopStatusComponentsPanel"
Orientation="Horizontal"
Spacing="6">
<comp:ClockWidget x:Name="ClockWidget"
IsVisible="False"
Margin="0" />
</StackPanel>
</Border>
<Border x:Name="BottomTaskbarContainer"
Classes="surface-translucent-island"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="1"
HorizontalAlignment="Stretch"
Margin="0"
CornerRadius="{DynamicResource DesignCornerRadiusLg}"
Padding="6">
<Grid ColumnDefinitions="Auto,*,Auto"
ColumnSpacing="8">
<Border x:Name="TaskbarFixedActionsHost"
Grid.Column="0"
Background="Transparent"
BorderThickness="0">
<Grid ColumnDefinitions="Auto"
ColumnSpacing="8">
<Button x:Name="BackToWindowsButton"
Grid.Column="0"
Padding="8"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
Click="OnMinimizeClick">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="8">
<fi:FluentIcon x:Name="BackToWindowsIcon"
Icon="Window"
IconVariant="Regular" />
<TextBlock x:Name="BackToWindowsTextBlock"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}" />
</StackPanel>
</Button>
</Grid>
</Border>
<Border x:Name="TaskbarDynamicActionsHost"
Grid.Column="1"
Background="Transparent"
BorderThickness="0"
IsVisible="False">
<StackPanel x:Name="TaskbarDynamicActionsPanel"
Orientation="Horizontal"
Spacing="8" />
</Border>
<Border x:Name="TaskbarSettingsActionHost"
Grid.Column="2"
Background="Transparent"
BorderThickness="0">
<Grid>
<Button x:Name="TaskbarProfileButton"
Padding="0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
Click="OnTaskbarProfileButtonClick">
<Grid HorizontalAlignment="Center"
VerticalAlignment="Center">
<Border x:Name="TaskbarProfileAvatarBorder"
Background="{DynamicResource AdaptiveButtonHoverBackgroundBrush}"
BorderBrush="{DynamicResource AdaptiveDockGlassBorderBrush}"
BorderThickness="1"
CornerRadius="999"
ClipToBounds="True">
<Grid>
<Image x:Name="TaskbarProfileAvatarImage"
Stretch="UniformToFill"
IsVisible="False" />
<TextBlock x:Name="TaskbarProfileAvatarFallbackText"
Classes="taskbar-profile-popup-primary"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="U" />
</Grid>
</Border>
</Grid>
</Button>
<Popup x:Name="TaskbarProfilePopup"
Placement="TopEdgeAlignedRight"
IsLightDismissEnabled="True">
<Border x:Name="TaskbarProfilePopupPanel"
Classes="taskbar-profile-popup-panel"
Margin="0,0,0,10">
<StackPanel Width="280"
Spacing="12">
<Grid ColumnDefinitions="Auto,*"
ColumnSpacing="12">
<Border x:Name="TaskbarProfileHeaderAvatarBorder"
Classes="taskbar-profile-popup-avatar"
Width="44"
Height="44"
ClipToBounds="True">
<Grid>
<Image x:Name="TaskbarProfileHeaderAvatarImage"
Stretch="UniformToFill"
IsVisible="False" />
<TextBlock x:Name="TaskbarProfileHeaderAvatarFallbackText"
Classes="taskbar-profile-popup-primary"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="U" />
</Grid>
</Border>
<StackPanel Grid.Column="1"
VerticalAlignment="Center"
Spacing="2">
<TextBlock x:Name="TaskbarProfileDisplayNameTextBlock"
Classes="taskbar-profile-popup-title"
Text="User" />
</StackPanel>
</Grid>
<Border x:Name="TaskbarProfilePopupDivider"
Height="1"
Background="{DynamicResource TaskbarProfilePopupDividerBrush}" />
<Button x:Name="TaskbarProfileSettingsActionButton"
Classes="taskbar-profile-popup-action"
Click="OnOpenSettingsClick">
<Grid ColumnDefinitions="Auto,*"
ColumnSpacing="12">
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
Kind="Settings" />
<TextBlock x:Name="TaskbarProfileSettingsActionTextBlock"
Grid.Column="1"
Classes="taskbar-profile-popup-action-text"
Text="Settings" />
</Grid>
</Button>
<Button x:Name="TaskbarProfileDesktopEditActionButton"
Classes="taskbar-profile-popup-action"
Click="OnOpenComponentLibraryClick">
<Grid ColumnDefinitions="Auto,*"
ColumnSpacing="12">
<mi:MaterialIcon Classes="taskbar-profile-popup-action-icon"
Kind="Pencil" />
<TextBlock x:Name="TaskbarProfileDesktopEditActionTextBlock"
Grid.Column="1"
Classes="taskbar-profile-popup-action-text"
Text="Edit Desktop" />
</Grid>
</Button>
</StackPanel>
</Border>
</Popup>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
<Border x:Name="ComponentLibraryWindow"
IsVisible="False"
Opacity="0"
Classes="surface-translucent-strong"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Width="620"
MinWidth="420"
MaxWidth="860"
Height="320"
MinHeight="260"
Margin="24,24,24,100"
CornerRadius="36"
Padding="14"
PointerPressed="OnComponentLibraryWindowPointerPressed"
PointerMoved="OnComponentLibraryWindowPointerMoved"
PointerReleased="OnComponentLibraryWindowPointerReleased">
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="{StaticResource FluttermotionToken.Duration.Slow}" />
</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="Widgets" />
<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="surface-translucent-panel"
CornerRadius="12"
Padding="14">
<Grid>
<!-- Category picker (outer) -->
<Grid x:Name="ComponentLibraryCategoriesView">
<Grid RowDefinitions="*">
<Border x:Name="ComponentLibraryCategoryViewport"
Background="Transparent"
ClipToBounds="True">
<ScrollViewer VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Disabled">
<Grid x:Name="ComponentLibraryCategoryPagesHost"
HorizontalAlignment="Stretch"
VerticalAlignment="Top">
<Grid x:Name="ComponentLibraryCategoryPagesContainer" />
</Grid>
</ScrollViewer>
</Border>
<TextBlock x:Name="ComponentLibraryEmptyTextBlock"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Foreground="{DynamicResource AdaptiveTextSecondaryBrush}"
Text="No components." />
</Grid>
</Grid>
<!-- Component picker (inner) -->
<Grid x:Name="ComponentLibraryComponentsView"
IsVisible="False"
RowDefinitions="Auto,*"
RowSpacing="10">
<Button x:Name="ComponentLibraryBackButton"
Grid.Row="0"
HorizontalAlignment="Left"
Padding="8,6"
Background="Transparent"
BorderThickness="0"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
Click="OnComponentLibraryBackClick">
<StackPanel Orientation="Horizontal" Spacing="8">
<fi:SymbolIcon Classes="icon-s" Symbol="ArrowLeft" IconVariant="Regular" />
<TextBlock x:Name="ComponentLibraryBackTextBlock"
VerticalAlignment="Center"
Text="Back" />
</StackPanel>
</Button>
<Grid Grid.Row="1"
ColumnDefinitions="Auto,*,Auto"
ColumnSpacing="8">
<Button x:Name="ComponentLibraryPrevComponentButton"
Grid.Column="0"
Width="36"
Height="36"
Padding="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
CornerRadius="18"
Click="OnComponentLibraryPrevComponentClick"
IsVisible="False">
<fi:SymbolIcon Symbol="ChevronLeft"
IconVariant="Regular" />
</Button>
<Border x:Name="ComponentLibraryComponentViewport"
Grid.Column="1"
Background="Transparent"
ClipToBounds="True"
PointerPressed="OnComponentLibraryComponentViewportPointerPressed"
PointerMoved="OnComponentLibraryComponentViewportPointerMoved"
PointerReleased="OnComponentLibraryComponentViewportPointerReleased"
PointerCaptureLost="OnComponentLibraryComponentViewportPointerCaptureLost">
<Grid>
<Grid x:Name="ComponentLibraryComponentPagesHost"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Grid.RenderTransform>
<TranslateTransform>
<TranslateTransform.Transitions>
<Transitions>
<DoubleTransition Property="X" Duration="{StaticResource FluttermotionToken.Duration.Page}" />
</Transitions>
</TranslateTransform.Transitions>
</TranslateTransform>
</Grid.RenderTransform>
<Grid x:Name="ComponentLibraryComponentPagesContainer" />
</Grid>
</Grid>
</Border>
<Button x:Name="ComponentLibraryNextComponentButton"
Grid.Column="2"
Width="36"
Height="36"
Padding="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
CornerRadius="18"
Click="OnComponentLibraryNextComponentClick"
IsVisible="False">
<fi:SymbolIcon Symbol="ChevronRight"
IconVariant="Regular" />
</Button>
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
</Border>
<Border x:Name="ComponentLibraryCollapsedChipHost"
IsVisible="False"
IsHitTestVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Margin="0,0,0,88"
Padding="14,10"
CornerRadius="999"
Classes="surface-translucent-strong"
BorderBrush="{DynamicResource AdaptiveDockGlassBorderBrush}"
BorderThickness="1"
Opacity="0">
<Border.Transitions>
<Transitions>
<DoubleTransition Property="Opacity" Duration="{StaticResource FluttermotionToken.Duration.Fast}" />
</Transitions>
</Border.Transitions>
<Grid ColumnDefinitions="Auto,*"
ColumnSpacing="10">
<fi:FluentIcon x:Name="ComponentLibraryCollapsedChipIcon"
Grid.Column="0"
Icon="Apps"
IconVariant="Regular"
Width="18"
Height="18"
VerticalAlignment="Center"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}" />
<TextBlock x:Name="ComponentLibraryCollapsedChipTextBlock"
Grid.Column="1"
VerticalAlignment="Center"
FontSize="14"
FontWeight="SemiBold"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
Text="Widgets" />
</Grid>
</Border>
</Grid>
</Window>