| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <hc:Window x:Class="TeamAAS.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:hc="https://handyorg.github.io/handycontrol"
- xmlns:prism="http://prismlibrary.com/"
- xmlns:conv="clr-namespace:TeamAAS.Converters"
- xmlns:loc="clr-namespace:TeamAAS.Localization"
- xmlns:ip="clr-namespace:MahApps.Metro.IconPacks;assembly=MahApps.Metro.IconPacks.Material"
- xmlns:g="clr-namespace:TeamAAS;assembly=TeamAAS.Global"
- Height="800" Width="1280"
- MinHeight="600" MinWidth="960"
- WindowState="Maximized"
- ShowTitle="False"
- ResizeMode="CanResizeWithGrip"
- RenderOptions.BitmapScalingMode="HighQuality"
- RenderOptions.ClearTypeHint="Enabled"
- NonClientAreaBackground="{DynamicResource PrimaryBrush}"
- WindowStartupLocation="CenterScreen"
- Background="{DynamicResource RegionBrush}">
- <hc:Window.NonClientAreaContent>
- <Grid hc:WindowAttach.IsDragElement="True">
- <Grid.ColumnDefinitions>
- <ColumnDefinition/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Text="{DynamicResource CenterTitleText}" FontWeight="Bold"
- Foreground="{DynamicResource PrimaryTextBrush}"
- VerticalAlignment="Center" Margin="16,0,0,0"/>
- <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
- <Button x:Name="RegistryMonitorButton"
- ToolTip="调试:监控 ResultRegistry(Main / Debug)"
- Visibility="Collapsed"
- hc:WindowAttach.IsDragElement="False"
- Click="RegistryMonitor_Click"
- Cursor="Hand"
- Background="Transparent" BorderThickness="0"
- Foreground="{DynamicResource PrimaryTextBrush}">
- <ip:PackIconMaterial x:Name="RegistryMonitorIcon"
- Foreground="{DynamicResource PrimaryTextBrush}"
- HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Button>
- <ToggleButton x:Name="SettingsToggle"
- ToolTip="{loc:Translate '主题设置'}"
-
- hc:WindowAttach.IsDragElement="False"
- Click="SettingsToggle_Click"
- Cursor="Hand"
- Background="Transparent" BorderThickness="0"
- Foreground="{DynamicResource PrimaryTextBrush}">
- <ip:PackIconMaterial Kind="Cog"
- Foreground="{DynamicResource PrimaryTextBrush}"
- HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </ToggleButton>
- <Popup x:Name="ThemePopup"
- StaysOpen="False"
- PlacementTarget="{Binding ElementName=SettingsToggle}"
- Placement="Bottom" HorizontalOffset="-120" VerticalOffset="6"
- PopupAnimation="Slide" AllowsTransparency="True"
- Closed="ThemePopup_Closed">
- <Border Background="{DynamicResource SecondaryRegionBrush}"
- BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
- CornerRadius="6" Padding="14">
- <StackPanel Width="240">
- <TextBlock Text="{loc:Translate '主题'}" FontSize="12" FontWeight="Bold"
- Foreground="{DynamicResource PrimaryTextBrush}" Margin="0,0,0,8"/>
- <Button Command="{Binding ToggleThemeCommand}"
- Padding="14,6" Margin="0,0,0,12" Cursor="Hand"
- Background="{DynamicResource SecondaryRegionBrush}"
- Foreground="{DynamicResource PrimaryTextBrush}"
- BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
- <StackPanel Orientation="Horizontal">
- <TextBlock Text="{Binding ThemeIcon}" Margin="0,0,6,0"/>
- <TextBlock Text="{Binding ThemeDisplayName}"/>
- </StackPanel>
- </Button>
- <Separator Background="{DynamicResource BorderBrush}" Margin="0,0,0,10"/>
- <TextBlock Text="{loc:Translate '主题色'}" FontSize="12" FontWeight="Bold"
- Foreground="{DynamicResource PrimaryTextBrush}" Margin="0,0,0,8"/>
- <ItemsControl ItemsSource="{Binding AccentColors}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Button Command="{Binding DataContext.SetAccentCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
- CommandParameter="{Binding Hex}"
- ToolTip="{Binding Name}"
- Background="Transparent" BorderThickness="0" Cursor="Hand"
- Padding="3" Margin="1">
- <Ellipse Width="20" Height="20" Fill="{Binding Brush}"
- Stroke="{DynamicResource BorderBrush}" StrokeThickness="1"/>
- </Button>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <Separator Background="{DynamicResource BorderBrush}" Margin="0,10"/>
- <TextBlock Text="{loc:Translate '自定义颜色'}" FontSize="12"
- Foreground="{DynamicResource SecondaryTextBrush}" Margin="0,0,0,6"/>
- <hc:ColorPicker SelectedBrush="{Binding AccentBrush, Mode=TwoWay}" Width="212"/>
- </StackPanel>
- </Border>
- </Popup>
- </StackPanel>
- </Grid>
- </hc:Window.NonClientAreaContent>
- <hc:Window.Resources>
- <conv:IsEqualConverter x:Key="IsEqualConverter"/>
- <g:IconKindConverter x:Key="IconKind"/>
- <!-- Navigation Button Style -->
- <Style x:Key="NavButton" TargetType="RadioButton">
- <Setter Property="MinWidth" Value="{DynamicResource NavButtonWidth}"/>
- <Setter Property="Height" Value="{DynamicResource NavButtonHeight}"/>
- <Setter Property="Margin" Value="2,0"/>
- <Setter Property="Cursor" Value="Hand"/>
- <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
- <Setter Property="FontSize" Value="{DynamicResource NavButtonFontSize}"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="RadioButton">
- <Border x:Name="bd" Background="Transparent" CornerRadius="8" Padding="8,4">
- <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <ip:PackIconMaterial x:Name="icon" Width="{DynamicResource NavIconSize}" Height="{DynamicResource NavIconSize}"
- Kind="{TemplateBinding Tag, Converter={StaticResource IconKind}}"
- Foreground="{DynamicResource SecondaryTextBrush}"
- HorizontalAlignment="Center" Margin="0,0,0,4"/>
- <ContentPresenter HorizontalAlignment="Center"/>
- </StackPanel>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="bd" Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
- </Trigger>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="bd" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
- <Setter Property="Foreground" Value="White"/>
- <Setter TargetName="icon" Property="Foreground" Value="White"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </hc:Window.Resources>
- <DockPanel>
- <!-- Top Navigation Bar -->
- <Border DockPanel.Dock="Top" Height="{DynamicResource TopBarHeight}"
- Background="{DynamicResource RegionBrush}"
- BorderBrush="{DynamicResource BorderBrush}"
- BorderThickness="0,0,0,1"
- hc:WindowAttach.IsDragElement="True">
- <Grid Margin="10,0">
- <!-- Left Navigation -->
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '首页'}" Tag="Home"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="HomeView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=HomeView, Mode=TwoWay}"/>
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '产品'}" Tag="CubeOutline"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="ProductView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=ProductView, Mode=TwoWay}"/>
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '设置'}" Tag="Cog"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="SettingView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=SettingView, Mode=TwoWay}"/>
- </StackPanel>
- <!-- Center Title -->
- <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
- <TextBlock Text="{DynamicResource CenterTitleText}"
- FontSize="{DynamicResource CenterTitleFontSize}" FontWeight="Bold"
- Foreground="{DynamicResource PrimaryBrush}"/>
- </StackPanel>
- <!-- Right Navigation + Theme Toggle -->
- <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
- <Rectangle Width="1" Height="36" Fill="{DynamicResource BorderBrush}" Margin="6,0"/>
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '标定'}" Tag="Ruler"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="CalibrationView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=CalibrationView, Mode=TwoWay}"/>
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '统计'}" Tag="ChartBar"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="StatisticsView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=StatisticsView, Mode=TwoWay}"/>
- <RadioButton Style="{StaticResource NavButton}" Content="{loc:Translate '用户'}" Tag="Account"
- GroupName="Nav" Command="{Binding NavigateCommand}" CommandParameter="UserView"
- IsChecked="{Binding CurrentView, Converter={StaticResource IsEqualConverter}, ConverterParameter=UserView, Mode=TwoWay}"/>
- <Rectangle Width="1" Height="36" Fill="{DynamicResource BorderBrush}" Margin="6,0"/>
- </StackPanel>
- </Grid>
- </Border>
- <!-- Bottom Status Bar -->
- <Border DockPanel.Dock="Bottom" Height="{DynamicResource StatusBarHeight}"
- Background="{DynamicResource SecondaryRegionBrush}"
- BorderBrush="{DynamicResource BorderBrush}"
- BorderThickness="0,1,0,0">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <!-- 左侧:设备状态(可换行,最多两行) -->
- <ItemsControl Grid.Column="0" ItemsSource="{Binding DeviceStatusItems}"
- Margin="16,0" VerticalAlignment="Center">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <WrapPanel Orientation="Horizontal"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <StackPanel Orientation="Horizontal" Margin="0,0,16,0" VerticalAlignment="Center">
- <Ellipse Width="8" Height="8" Margin="0,0,6,0">
- <Ellipse.Style>
- <Style TargetType="Ellipse">
- <Setter Property="Fill" Value="#F44336"/>
- <Style.Triggers>
- <DataTrigger Binding="{Binding IsConnected}" Value="True">
- <Setter Property="Fill" Value="#4CAF50"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Ellipse.Style>
- </Ellipse>
- <TextBlock FontSize="{DynamicResource StatusBarFontSize}" Foreground="{DynamicResource SecondaryTextBrush}" VerticalAlignment="Center">
- <Run Text="{Binding Category}"/><Run Text=": "/><Run Text="{Binding Name}"/>
- </TextBlock>
- </StackPanel>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- <!-- 右侧:内存 + 时间 -->
- <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="16,0">
- <TextBlock Text="{Binding MemoryUsage}" FontSize="{DynamicResource StatusBarFontSize}" Foreground="{DynamicResource SecondaryTextBrush}" Margin="0,0,16,0"/>
- <TextBlock Text="{Binding CurrentTime}" FontSize="{DynamicResource StatusBarFontSize}" Foreground="{DynamicResource SecondaryTextBrush}"/>
- </StackPanel>
- </Grid>
- </Border>
- <!-- Content Area -->
- <ContentControl prism:RegionManager.RegionName="ContentRegion"
- Background="{DynamicResource RegionBrush}"/>
- </DockPanel>
- </hc:Window>
|