<Application x:Class="DeviceService.App"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:local="clr-namespace:DeviceService"
|
StartupUri="MainWindow.xaml">
|
<Application.Resources>
|
|
<!-- ============ 调色板 ============ -->
|
<SolidColorBrush x:Key="PageBackgroundBrush" Color="#F3F4F6" />
|
<SolidColorBrush x:Key="CardBackgroundBrush" Color="#FFFFFF" />
|
<SolidColorBrush x:Key="CardBorderBrush" Color="#E5E7EB" />
|
<SolidColorBrush x:Key="AccentBrush" Color="#2563EB" />
|
<SolidColorBrush x:Key="AccentHoverBrush" Color="#1D4ED8" />
|
<SolidColorBrush x:Key="AccentPressedBrush" Color="#1E40AF" />
|
<SolidColorBrush x:Key="AccentSoftBrush" Color="#DBEAFE" />
|
<SolidColorBrush x:Key="AccentFaintBrush" Color="#EFF6FF" />
|
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#111827" />
|
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#6B7280" />
|
<SolidColorBrush x:Key="InputBorderBrush" Color="#D1D5DB" />
|
<SolidColorBrush x:Key="InputHoverBorderBrush" Color="#9CA3AF" />
|
<SolidColorBrush x:Key="TerminalBackgroundBrush" Color="#1E293B" />
|
<SolidColorBrush x:Key="TerminalForegroundBrush" Color="#E2E8F0" />
|
|
<!-- ============ 卡片容器 ============ -->
|
<Style x:Key="CardBorder" TargetType="Border">
|
<Setter Property="Background" Value="{StaticResource CardBackgroundBrush}" />
|
<Setter Property="BorderBrush" Value="{StaticResource CardBorderBrush}" />
|
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="CornerRadius" Value="8" />
|
<Setter Property="Padding" Value="8" />
|
</Style>
|
|
<Style x:Key="TitleText" TargetType="TextBlock">
|
<Setter Property="FontSize" Value="14" />
|
<Setter Property="FontWeight" Value="Bold" />
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
</Style>
|
|
<Style x:Key="SectionText" TargetType="TextBlock">
|
<Setter Property="FontSize" Value="17" />
|
<Setter Property="FontWeight" Value="Bold" />
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
</Style>
|
|
<!-- ============ 按钮 ============ -->
|
<Style x:Key="PrimaryButton" TargetType="Button">
|
<Setter Property="Background" Value="{StaticResource AccentBrush}" />
|
<Setter Property="Foreground" Value="White" />
|
<Setter Property="FontSize" Value="13" />
|
<Setter Property="FontWeight" Value="SemiBold" />
|
<Setter Property="Padding" Value="12,7" />
|
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="Button">
|
<Border x:Name="Bd"
|
Background="{TemplateBinding Background}"
|
CornerRadius="6"
|
Padding="{TemplateBinding Padding}">
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentHoverBrush}" />
|
</Trigger>
|
<Trigger Property="IsPressed" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentPressedBrush}" />
|
</Trigger>
|
<Trigger Property="IsEnabled" Value="False">
|
<Setter TargetName="Bd" Property="Background" Value="#93C5FD" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<Style x:Key="SecondaryButton" TargetType="Button">
|
<Setter Property="Background" Value="#FFFFFF" />
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
|
<Setter Property="FontSize" Value="13" />
|
<Setter Property="Padding" Value="12,6" />
|
<Setter Property="Cursor" Value="Hand" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="Button">
|
<Border x:Name="Bd"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="1"
|
CornerRadius="6"
|
Padding="{TemplateBinding Padding}">
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentFaintBrush}" />
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource AccentBrush}" />
|
</Trigger>
|
<Trigger Property="IsPressed" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentSoftBrush}" />
|
</Trigger>
|
<Trigger Property="IsEnabled" Value="False">
|
<Setter TargetName="Bd" Property="Opacity" Value="0.5" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<!-- ============ 输入框 ============ -->
|
<Style x:Key="InputTextBox" TargetType="TextBox">
|
<Setter Property="Background" Value="#FFFFFF" />
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
<Setter Property="BorderBrush" Value="{StaticResource InputBorderBrush}" />
|
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="Padding" Value="10,6" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="CaretBrush" Value="{StaticResource AccentBrush}" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="TextBox">
|
<Border x:Name="Bd"
|
Background="{TemplateBinding Background}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
CornerRadius="6">
|
<ScrollViewer x:Name="PART_ContentHost"
|
Margin="{TemplateBinding Padding}"
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource InputHoverBorderBrush}" />
|
</Trigger>
|
<Trigger Property="IsKeyboardFocusWithin" Value="True">
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{StaticResource AccentBrush}" />
|
</Trigger>
|
<Trigger Property="IsEnabled" Value="False">
|
<Setter TargetName="Bd" Property="Background" Value="#F9FAFB" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<!-- 终端风格日志框 -->
|
<Style x:Key="TerminalTextBox" TargetType="TextBox" BasedOn="{StaticResource InputTextBox}">
|
<Setter Property="Background" Value="{StaticResource TerminalBackgroundBrush}" />
|
<Setter Property="Foreground" Value="{StaticResource TerminalForegroundBrush}" />
|
<Setter Property="BorderBrush" Value="#334155" />
|
<Setter Property="Padding" Value="10,8" />
|
<Setter Property="FontFamily" Value="Consolas" />
|
<Setter Property="FontSize" Value="12.5" />
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
</Style>
|
|
<!-- ============ TreeViewItem ============ -->
|
<Style x:Key="DeviceTreeViewItem" TargetType="TreeViewItem">
|
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
<Setter Property="Padding" Value="6,6" />
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="TreeViewItem">
|
<StackPanel>
|
<Border x:Name="HeaderBorder"
|
Background="Transparent"
|
CornerRadius="6"
|
Padding="{TemplateBinding Padding}"
|
Margin="0,1">
|
<Grid>
|
<Grid.ColumnDefinitions>
|
<ColumnDefinition Width="16" />
|
<ColumnDefinition Width="*" />
|
</Grid.ColumnDefinitions>
|
<ToggleButton x:Name="Expander"
|
Focusable="False"
|
ClickMode="Press"
|
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}">
|
<ToggleButton.Template>
|
<ControlTemplate TargetType="ToggleButton">
|
<Border Background="Transparent">
|
<Path x:Name="Arrow"
|
Data="M0,0 L4,4 L0,8 Z"
|
Fill="{StaticResource TextSecondaryBrush}"
|
HorizontalAlignment="Center"
|
VerticalAlignment="Center"
|
RenderTransformOrigin="0.5,0.5">
|
<Path.RenderTransform>
|
<RotateTransform Angle="0" />
|
</Path.RenderTransform>
|
</Path>
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsChecked" Value="True">
|
<Setter TargetName="Arrow" Property="RenderTransform">
|
<Setter.Value>
|
<RotateTransform Angle="90" />
|
</Setter.Value>
|
</Setter>
|
</Trigger>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter TargetName="Arrow" Property="Fill" Value="{StaticResource AccentBrush}" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</ToggleButton.Template>
|
</ToggleButton>
|
<ContentPresenter Grid.Column="1" ContentSource="Header" />
|
</Grid>
|
</Border>
|
<ItemsPresenter x:Name="ItemsHost" Margin="16,0,0,0" Visibility="Collapsed" />
|
</StackPanel>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsExpanded" Value="True">
|
<Setter TargetName="ItemsHost" Property="Visibility" Value="Visible" />
|
</Trigger>
|
<Trigger Property="HasItems" Value="False">
|
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
|
</Trigger>
|
<Trigger SourceName="HeaderBorder" Property="IsMouseOver" Value="True">
|
<Setter TargetName="HeaderBorder" Property="Background" Value="{StaticResource AccentFaintBrush}" />
|
</Trigger>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter TargetName="HeaderBorder" Property="Background" Value="{StaticResource AccentSoftBrush}" />
|
<Setter Property="Foreground" Value="{StaticResource AccentPressedBrush}" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
<!-- ============ ListBox 项 ============ -->
|
<Style x:Key="RowListBoxItem" TargetType="ListBoxItem">
|
<Setter Property="Foreground" Value="{StaticResource TextPrimaryBrush}" />
|
<Setter Property="Template">
|
<Setter.Value>
|
<ControlTemplate TargetType="ListBoxItem">
|
<Border x:Name="Bd"
|
Background="Transparent"
|
CornerRadius="6"
|
Padding="10,7"
|
Margin="0,1">
|
<ContentPresenter />
|
</Border>
|
<ControlTemplate.Triggers>
|
<Trigger Property="IsMouseOver" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentFaintBrush}" />
|
</Trigger>
|
<Trigger Property="IsSelected" Value="True">
|
<Setter TargetName="Bd" Property="Background" Value="{StaticResource AccentSoftBrush}" />
|
<Setter Property="Foreground" Value="{StaticResource AccentPressedBrush}" />
|
<Setter Property="FontWeight" Value="SemiBold" />
|
</Trigger>
|
</ControlTemplate.Triggers>
|
</ControlTemplate>
|
</Setter.Value>
|
</Setter>
|
</Style>
|
|
</Application.Resources>
|
</Application>
|