From ef52fd6fd07508883dce4eb002acda59f0169e59 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 23 四月 2026 10:19:33 +0800
Subject: [PATCH] 优化;

---
 WPFProject/PanuonWindow.xaml |  282 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 218 insertions(+), 64 deletions(-)

diff --git a/WPFProject/PanuonWindow.xaml b/WPFProject/PanuonWindow.xaml
index ef1eee4..b9ccb20 100644
--- a/WPFProject/PanuonWindow.xaml
+++ b/WPFProject/PanuonWindow.xaml
@@ -8,23 +8,25 @@
             xmlns:pu="https://opensource.panuon.com/wpf-ui"
             xmlns:ctl="clr-namespace:WPFProject.Controls"
             mc:Ignorable="d"
+            xmlns:dc="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
             WindowStartupLocation="CenterOwner"
             WindowState="Maximized"
             x:Name="window"
             BorderBrush="Transparent"
-            pu:WindowXCaption.Buttons="All"
+            pu:WindowXCaption.Buttons="None"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
             xmlns:hc="clr-namespace:HMI.Core;assembly=HMI.Core"
             Closed="window_Closed"
             Topmost="False"
+            pu:WindowXCaption.HeaderAlignment="Stretch"
             Title="TestPlatform"
             pu:WindowXCaption.Background="Transparent"
-            pu:WindowXCaption.Height="80"
-            IsOverlayerVisible="True"
+            pu:WindowXCaption.Height="60"
             pu:WindowXCaption.Foreground="#FFF">
     <Window.Resources>
         <hc:LangConverter x:Key="lc"/>
+        <dc:CollectionVisibility x:Key="cv"/>
         <Style x:Key="UserMenu" TargetType="Menu" BasedOn="{StaticResource {x:Static pu:StyleKeys.MenuStyle}}">
             <Setter Property="Background" Value="{StaticResource PrimaryColor}"/>
             <Setter Property="Foreground" Value="#FFF"/>
@@ -37,7 +39,6 @@
             <Setter Property="pu:MenuHelper.TopLevelItemsHoverBackground" Value="{x:Null}"/>
             <Setter Property="pu:MenuHelper.TopLevelDropDownPlacement" Value="BottomLeft"/>
         </Style>
-
     </Window.Resources>
     <Window.Background>
         <ImageBrush Stretch="Uniform" AlignmentX="Left" AlignmentY="Top"  
@@ -46,67 +47,206 @@
 
     <pu:WindowXCaption.HeaderTemplate>
         <DataTemplate>
-            <StackPanel DataContext="{Binding ElementName=window}" Orientation="Horizontal"
-                        VerticalAlignment="Center"
-                        dp:StackPanelHelper.ChildSpace="30" Margin="5,0,0,0" Height="100">
-                <Image Source="{Binding WindowLogo}" Height="60" VerticalAlignment="Center" Stretch="Fill"
-       RenderOptions.BitmapScalingMode="HighQuality" />
-                <TextBlock FontSize="30" VerticalAlignment="Center" Text="{Binding WindowTitle}">
-                    <TextBlock.Effect>
-                        <DropShadowEffect ShadowDepth="8"
-      Direction="330"
-      Color="Black"
-      Opacity="0.5"
-     BlurRadius="4"/>
-                    </TextBlock.Effect>
-                </TextBlock>
-            </StackPanel>
+            <DockPanel DataContext="{Binding ElementName=window}" WindowChrome.IsHitTestVisibleInChrome="True" 
+                       VerticalAlignment="Center" Height="80">
+                <StackPanel Orientation="Horizontal">
+                    <Image DockPanel.Dock="Left" Source="{Binding WindowLogo}" Margin="5,0,20,0" Height="40" VerticalAlignment="Center" Stretch="Fill"
+  RenderOptions.BitmapScalingMode="HighQuality" />
+                    <TextBlock FontSize="30" VerticalAlignment="Center" Text="{Binding WindowTitle}">
+                        <TextBlock.Effect>
+                            <DropShadowEffect ShadowDepth="8"
+ Direction="330"
+ Color="Black"
+ Opacity="0.5"
+BlurRadius="4"/>
+                        </TextBlock.Effect>
+                    </TextBlock>
+                </StackPanel>
+
+                <Grid DockPanel.Dock="Right" VerticalAlignment="Stretch">
+                    <Grid.RowDefinitions>
+                        <RowDefinition />
+                        <RowDefinition Height="Auto"/>
+                    </Grid.RowDefinitions>
+                    <StackPanel Grid.Row="0" VerticalAlignment="Top" Margin="10,10,0,0" Orientation="Horizontal">
+                        <Menu Margin="0" Padding="0" VerticalAlignment="Top"
+  VerticalContentAlignment="Center" Style="{StaticResource UserMenu}" Background="Transparent">
+                            <MenuItem x:Name="userMenu" Header="{Binding WelcomeTitle}" FontSize="16">
+                                <MenuItem Icon="&#xe61d;" Cursor="Hand" FontSize="14" Header="閫�鍑虹櫥褰�" 
+                                      x:Name="MiLogout" Click="MenuItem_Click"/>
+                                <MenuItem Cursor="Hand" FontSize="14" Icon="&#xe867;"
+              Header="閲嶆柊鍚姩"
+              x:Name="MiRestart"
+              Click="MenuItem_Click"/>
+                            </MenuItem>
+                        </Menu>
+
+                        <Button x:Name="BtnSwitchTheme"
+FontSize="18"
+FontFamily="/HMI.UI;component/Resources/Font/#iconfont"
+Content="&#xe60e;"
+RenderTransformOrigin="0.5,0.5"
+Click="Button_Click">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.MinimizeButtonStyleKey}}">
+                                    <Setter Property="Focusable" Value="False"/>
+                                    <Style.Triggers>
+                                        <DataTrigger Binding="{Binding ShowMenu}" Value="True">
+                                            <Setter Property="Button.RenderTransform">
+                                                <Setter.Value>
+                                                    <RotateTransform x:Name="MyAnimatedTransform" Angle="180" />
+                                                </Setter.Value>
+                                            </Setter>
+                                        </DataTrigger>
+                                    </Style.Triggers>
+                                </Style>
+                            </Button.Style>
+                        </Button>
+
+                        <Button FontSize="18" Click="Button_Click" x:Name="minBtn">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.MinimizeButtonStyleKey}}">
+                                    <Setter Property="Focusable" Value="False"/>
+                                    <Setter Property="IsHitTestVisible" Value="True"/>
+                                </Style>
+                            </Button.Style>
+                        </Button>
+
+                        <Button FontSize="18" Click="Button_Click" x:Name="maxBtn">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.MaximizeButtonStyleKey}}">
+                                    <Setter Property="Focusable" Value="False"/>
+                                </Style>
+                            </Button.Style>
+                        </Button>
+
+                        <Button FontSize="18" Click="Button_Click" x:Name="closeBtn">
+                            <Button.Style>
+                                <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.CloseButtonStyleKey}}">
+                                    <Setter Property="Focusable" Value="False"/>
+                                </Style>
+                            </Button.Style>
+                        </Button>
+                    </StackPanel>
+                    <DockPanel Margin="20,0,0,20" Grid.Row="1" LastChildFill="False">
+                        <Button DockPanel.Dock="Left" Foreground="#FFF"  
+    Visibility="{Binding Alarms.Count,Converter={StaticResource cv}}"
+    HorizontalContentAlignment="Left" Style="{StaticResource LinkButton}"
+    Click="Clear_AllAlarm_Click"
+    Content="娓呴櫎鍏ㄩ儴鎶ヨ"/>
+                        <!--<local:ResourceUI x:Name="resourceUI" Loaded="resourceUI_Loaded" DockPanel.Dock="Right"/>--> 
+                    </DockPanel>
+                </Grid>
+
+                <ListBox x:Name="list"
+                        Margin="20,15,10,15"
+                        Background="#6FFFFFFF"
+                        BorderThickness="0"
+                             pu:ListBoxHelper.CornerRadius="5"
+                             pu:ListBoxHelper.ItemsCornerRadius="5"
+                             pu:ListBoxHelper.ItemsBackground="Red"
+                             pu:ListBoxHelper.ItemsHoverBackground="#b20000"
+                             pu:ListBoxHelper.ItemsSelectedBackground="#b20000"
+                             pu:ListBoxHelper.ItemsIcon="&#xe931;"
+                             ItemsSource="{Binding Alarms}"
+                             Loaded="list_Loaded"
+                             FontSize="15" Foreground="#FFF"
+                             pu:IconHelper.FontFamily="/Panuon.WPF.UI;component/Resources/Fonts/#PanuonIcon"
+                             pu:IconHelper.Foreground="Green"
+                             pu:IconHelper.FontSize="20"
+                             pu:IconHelper.Margin="5,0,5,0"
+                             FontWeight="UltraBlack"
+                             pu:ListBoxHelper.ItemsSeparatorVisibility="Visible"
+                             pu:ListBoxHelper.ItemsSeparatorBrush="Transparent"
+                             pu:ListBoxHelper.ItemsRemoveButtonVisibility="Visible">
+
+                    <ListBox.Style>
+                        <Style TargetType="ListBox" BasedOn="{StaticResource {x:Static pu:StyleKeys.ListBoxStyle}}">
+                            <Setter Property="Visibility" Value="Visible"/>
+                            <Style.Triggers>
+                                <DataTrigger Binding="{Binding Alarms.Count}" Value="0">
+                                    <Setter Property="Visibility" Value="Hidden"/>
+                                </DataTrigger>
+                            </Style.Triggers>
+                        </Style>
+                    </ListBox.Style>
+
+                    <ListBox.Resources>
+                        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">6</sys:Double>
+
+                        <ControlTemplate x:Key="VerticalScrollBar" TargetType="RangeBase">
+                            <Border Width="{TemplateBinding Width}" CornerRadius="2" 
+                                        Background="{DynamicResource CommonBoarder}">
+                                <Track Name="PART_Track" IsDirectionReversed="true">
+                                    <Track.DecreaseRepeatButton>
+                                        <RepeatButton Command="ScrollBar.PageUpCommand" Focusable="False">
+                                            <RepeatButton.Template>
+                                                <ControlTemplate>
+                                                    <Border Background="Transparent"></Border>
+                                                </ControlTemplate>
+                                            </RepeatButton.Template>
+                                        </RepeatButton>
+                                    </Track.DecreaseRepeatButton>
+                                    <Track.Thumb>
+                                        <Thumb Width="{TemplateBinding Width}"  Focusable="False">
+                                            <Thumb.Template>
+                                                <ControlTemplate>
+                                                    <Border Background="Gray"
+                                                                CornerRadius="2" />
+                                                </ControlTemplate>
+                                            </Thumb.Template>
+                                        </Thumb>
+                                    </Track.Thumb>
+                                    <Track.IncreaseRepeatButton>
+                                        <RepeatButton Command="ScrollBar.PageDownCommand" Focusable="False">
+                                            <RepeatButton.Template>
+                                                <ControlTemplate>
+                                                    <Border Background="Transparent"></Border>
+                                                </ControlTemplate>
+                                            </RepeatButton.Template>
+                                        </RepeatButton>
+                                    </Track.IncreaseRepeatButton>
+                                </Track>
+                            </Border>
+                        </ControlTemplate>
+
+                        <Style x:Key="ScrollStyle_Mobile" TargetType="ScrollBar">
+                            <Style.Resources>
+                                <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">6</sys:Double>
+                                <sys:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">6</sys:Double>
+                            </Style.Resources>
+                            <Style.Triggers>
+                                <Trigger Property="Orientation" Value="Vertical">
+                                    <Setter Property="Width" Value="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
+                                    <Setter Property="Height" Value="Auto" />
+                                    <Setter Property="Margin" Value="0" />
+                                    <Setter Property="Template" Value="{DynamicResource VerticalScrollBar}" />
+                                </Trigger>
+                            </Style.Triggers>
+                        </Style>
+
+
+                        <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollStyle_Mobile}"/>
+                    </ListBox.Resources>
+
+                    <ListBox.ItemContainerStyle>
+                        <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Static pu:StyleKeys.ListBoxItemStyle}}">
+                            <Setter Property="Padding" Value="0"/>
+                            <Setter Property="VerticalContentAlignment" Value="Center"/>
+                            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+                            <Setter Property="Height" Value="50"/>
+                            <Setter Property="Margin" Value="0,0,0,1"/>
+                            <Setter Property="BorderThickness" Value="0"/>
+                        </Style>
+                    </ListBox.ItemContainerStyle>
+                </ListBox>
+            </DockPanel>
         </DataTemplate>
     </pu:WindowXCaption.HeaderTemplate>
 
-    <pu:WindowXCaption.ExtendControl>
-        <StackPanel Orientation="Horizontal">
-            <Menu Margin="0" Padding="0" VerticalAlignment="Top"
-                  VerticalContentAlignment="Center" Style="{StaticResource UserMenu}"
-                  
-                  Background="Transparent">
-                <MenuItem x:Name="userMenu" FontSize="16">
-                    <MenuItem 
-                        Icon="&#xe61d;"
-                        Cursor="Hand" FontSize="14" Header="閫�鍑虹櫥褰�"
-                              x:Name="MiLogout"
-                              Click="MenuItem_Click"/>
-                    <MenuItem Cursor="Hand" FontSize="14" 
-                        Icon="&#xe867;"
-                              Header="閲嶆柊鍚姩"
-                              x:Name="MiRestart"
-                              Click="MenuItem_Click"/>
-                </MenuItem>
-            </Menu>
-
-            <Button x:Name="BtnSwitchTheme"
-                FontSize="18"
-                FontFamily="/HMI.UI;component/Resources/Font/#iconfont"
-                Content="&#xe60e;"
-                RenderTransformOrigin="0.5,0.5"
-                Click="Button_Click_2">
-                <Button.Style>
-                    <Style TargetType="Button" BasedOn="{StaticResource {x:Static pu:WindowXCaption.MinimizeButtonStyleKey}}">
-                        <Style.Triggers>
-                            <DataTrigger Binding="{Binding ShowMenu}" Value="True">
-                                <Setter Property="Button.RenderTransform">
-                                    <Setter.Value>
-                                        <RotateTransform x:Name="MyAnimatedTransform" Angle="180" />
-                                    </Setter.Value>
-                                </Setter>
-                            </DataTrigger>
-                        </Style.Triggers>
-                    </Style>
-                </Button.Style>
-
-            </Button>
-        </StackPanel>
-    </pu:WindowXCaption.ExtendControl>
+    <!--<pu:WindowXCaption.ExtendControl>
+        
+    </pu:WindowXCaption.ExtendControl>-->
 
     <Grid>
         <Grid.RowDefinitions>
@@ -114,13 +254,27 @@
             <RowDefinition Height="Auto"/>
         </Grid.RowDefinitions>
 
-        <ctl:MainTabControl Grid.Row="0" x:Name="menuTab">
+        <ctl:MainTabControl Grid.Row="0" x:Name="menuTab" TabChanged="menuTab_TabChanged">
 
         </ctl:MainTabControl>
 
         <!--<ctl:MenuTabControl Grid.Row="1" x:Name="menuTab" OnTabChange="menuTab_OnTabChange"> </ctl:MenuTabControl>-->
 
 
-        <!--<StatusBar Grid.Row="1" Background="{StaticResource HoriBar}"></StatusBar>-->
+        <DockPanel Grid.Row="1" Height="20" Background="{StaticResource PrimaryColor}" LastChildFill="False">
+
+            <TextBlock Margin="20,0,0,0" FontSize="14" VerticalAlignment="Center" Foreground="#FFF">
+<Run Text="{DynamicResource App.Version}"/> 
+<Run Text="{Binding SoftwareVersion}"/>
+            </TextBlock>
+
+            <TextBlock Margin="20,0,0,0" FontSize="14" VerticalAlignment="Center" Foreground="#FFF">
+<Run Text="{DynamicResource App.PluginVersion}"/> 
+<Run Text="{Binding PluginVersion}"/>
+            </TextBlock>
+
+            <local:ResourceUI FontSize="14" Margin="0,1,20,1" DockPanel.Dock="Right" x:Name="resourceUI"/>
+
+        </DockPanel>
     </Grid>
 </pu:WindowX>

--
Gitblit v1.9.1