alielie
2025-08-25 c4a3f8db90530a727ffab77c3bb5bb7d782792bf
WPFProject/PanuonWindow.xaml
@@ -18,6 +18,7 @@
            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"
@@ -46,10 +47,10 @@
    <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"
            <DockPanel DataContext="{Binding ElementName=window}" WindowChrome.IsHitTestVisibleInChrome="True"
                        VerticalAlignment="Center" Height="100">
                <StackPanel Orientation="Horizontal">
                    <Image DockPanel.Dock="Left" Source="{Binding WindowLogo}" Margin="5,0,20,0" Height="60" VerticalAlignment="Center" Stretch="Fill"
       RenderOptions.BitmapScalingMode="HighQuality" />
                <TextBlock FontSize="30" VerticalAlignment="Center" Text="{Binding WindowTitle}">
                    <TextBlock.Effect>
@@ -61,23 +62,16 @@
                    </TextBlock.Effect>
                </TextBlock>
            </StackPanel>
        </DataTemplate>
    </pu:WindowXCaption.HeaderTemplate>
    <pu:WindowXCaption.ExtendControl>
        <StackPanel Orientation="Horizontal">
                <StackPanel DockPanel.Dock="Right" 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" FontSize="16">
                    <MenuItem
                        Icon="&#xe61d;"
                        Cursor="Hand" FontSize="14" Header="退出登录"
                              x:Name="MiLogout"
                              Click="MenuItem_Click"/>
                    <MenuItem Cursor="Hand" FontSize="14"
                        Icon="&#xe867;"
                        <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"/>
@@ -110,6 +104,7 @@
                <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>
@@ -130,7 +125,122 @@
                </Button.Style>
            </Button>
        </StackPanel>
    </pu:WindowXCaption.ExtendControl>
                <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="70"/>
                            <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>
    </pu:WindowXCaption.ExtendControl>-->
    <Grid>
        <Grid.RowDefinitions>