From 12acdf14fcddae8d16e00b7b981559da67ce60ea Mon Sep 17 00:00:00 2001
From: Chr <haoran.cheng@skonda.com.cn>
Date: 星期五, 23 八月 2024 08:53:20 +0800
Subject: [PATCH] 完善消息通知程序;

---
 PdmAlert/MainWindow.xaml |  119 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 89 insertions(+), 30 deletions(-)

diff --git a/PdmAlert/MainWindow.xaml b/PdmAlert/MainWindow.xaml
index 3defeb9..ad6f032 100644
--- a/PdmAlert/MainWindow.xaml
+++ b/PdmAlert/MainWindow.xaml
@@ -39,7 +39,7 @@
                 <Setter Property="FontWeight" Value="SemiBold"/>
                 <Setter Property="Foreground" Value="Black"/>
                 <Setter Property="Width" Value="50"/>
-                <Setter Property="FontSize" Value="20"/>
+                <Setter Property="FontSize" Value="30"/>
                 <Setter Property="BorderThickness" Value="1"/>
                 <Setter Property="BorderBrush" Value="Transparent"/>
 
@@ -97,44 +97,103 @@
 
             </Style>
 
-            <Style x:Key="LinkButton" TargetType="Button">
-                <Setter Property="FontFamily" Value="{StaticResource iconfont}"/>
-                <Setter Property="Foreground" Value="{StaticResource ChildBorder}"/>
-
+            <Style x:Key="LinkButton" TargetType="{x:Type Button}" >
                 <Setter Property="Template">
                     <Setter.Value>
-                        <ControlTemplate TargetType="Button">
-                            <TextBlock Style="{x:Null}" x:Name="label" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
-                           Foreground="{TemplateBinding Foreground}"
-                                   Text="{TemplateBinding Content}"/>
+                        <ControlTemplate TargetType="{x:Type ButtonBase}">
+                            <ContentPresenter x:Name="buttonContent" TextBlock.FontSize="{TemplateBinding FontSize}" 
+                        TextBlock.FontFamily="{StaticResource iconfont}" 
+                        TextBlock.Foreground="{StaticResource ChildBorder}" 
+                        Margin="0,0,5,0"
+                        VerticalAlignment="Center" 
+                        HorizontalAlignment="Center"
+                        Content="{TemplateBinding Content}"/>
+                            <ControlTemplate.Triggers>
+                                <Trigger Property="IsMouseOver" Value="True">
+                                    <Setter TargetName="buttonContent" Property="TextBlock.Foreground" Value="Purple"/>
+                                    <Setter TargetName="buttonContent" Property="Cursor" Value="Hand"/>
+                                </Trigger>
+                            </ControlTemplate.Triggers>
                         </ControlTemplate>
                     </Setter.Value>
                 </Setter>
             </Style>
         </ResourceDictionary>
     </Window.Resources>
+    <Border BorderBrush="Black" BorderThickness="1">
+        <Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="Auto"/>
+                <RowDefinition Height="*"/>
+            </Grid.RowDefinitions>
+            <Border Grid.Row="0" Background="LightGray">
+                <DockPanel LastChildFill="True">
+                    <Button DockPanel.Dock="Right" Style="{StaticResource WindowCloseButton}" Click="Hide_Click" ToolTip="鏈�灏忓寲">&#xe67a;</Button>
+                    <Button DockPanel.Dock="Right" Style="{StaticResource WindowButton}" Click="SwitchUser_Click" ToolTip="鍒囨崲鐢ㄦ埛">&#xe6ed;</Button>
+                    <Button DockPanel.Dock="Right" Style="{StaticResource WindowButton}" Click="Refresh_Click" BorderBrush="Black" ToolTip="鍒锋柊">&#xe600;</Button>
+                    <Label Content="{Binding userInfo}" FontSize="20" VerticalContentAlignment="Center"/>
+                </DockPanel>
+            </Border>
 
+            <AdornerDecorator Grid.Row="1">
+                <Grid x:Name="mainContent" >
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="Auto"/>
+                        <RowDefinition Height="*"/>
+                        <RowDefinition Height="Auto"/>
+                    </Grid.RowDefinitions>
+                    <DockPanel Grid.Row="0" LastChildFill="True" HorizontalAlignment="Stretch" >
+                        <Button DockPanel.Dock="Right" Margin="0,0,20,0" FontSize="16" Style="{StaticResource LinkButton}" Click="ReadAll_Click">鍏ㄩ儴宸茶</Button>
+                        <Label DockPanel.Dock="Left" FontSize="16" Content="{Binding messageTitle}"/>
+                    </DockPanel>
 
-    <StackPanel>
-        <Border BorderThickness="0" Background="LightGray">
-            <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
-                <Button Style="{StaticResource WindowButton}" Click="Refresh_Click" BorderBrush="Black" ToolTip="鍒锋柊">&#xe600;</Button>
-                <Button Style="{StaticResource WindowButton}" Click="SwitchUser_Click" ToolTip="鍒囨崲鐢ㄦ埛">&#xe6ed;</Button>
-                <Button Style="{StaticResource WindowCloseButton}" Click="Hide_Click" ToolTip="鏈�灏忓寲">&#xe67a;</Button>
-            </StackPanel>
-        </Border>
+                    <ListView BorderThickness="0,1,0,1" Grid.Row="1" ItemsSource="{Binding messages}">
+                        <ListView.ItemContainerStyle>
+                            <Style TargetType="{x:Type ListViewItem}">
+                                <Setter Property="Focusable" Value="False"/>
+                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
+                            </Style>
+                        </ListView.ItemContainerStyle>
 
-
-        <Label Content="{Binding messageTitle}"/>
-
-        <ListView ItemsSource="{Binding messages}">
-            <ListView.ItemTemplate>
-                <DataTemplate>
-                    <Label Content="999"/>
-                </DataTemplate>
-            </ListView.ItemTemplate>
-        </ListView>
-
-    </StackPanel>
-
+                        <ListView.ItemTemplate>
+                            <DataTemplate>
+                                <DockPanel LastChildFill="True">
+                                    <Button DockPanel.Dock="Right" FontSize="16" Margin="0,0,15,0" 
+                                        DataContext="{Binding}"
+                                        Click="SingleRead_Click"
+                                        Style="{StaticResource LinkButton}">宸茶</Button>
+                                    <StackPanel DockPanel.Dock="Right">
+                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
+                                            <Label FontSize="18" FontWeight="Bold" Content="{Binding titile}"/>
+                                            <Label FontSize="18" FontWeight="Bold" Content="{Binding sendTime}"/>
+                                        </StackPanel>
+                                        <Label FontSize="16" Content="{Binding msgContent}"/>
+                                    </StackPanel>
+                                </DockPanel>
+                            </DataTemplate>
+                        </ListView.ItemTemplate>
+                    </ListView>
+                    <StatusBar Grid.Row="2" VerticalAlignment="Center">
+                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
+                            <Ellipse Width="12" Height="12"  VerticalAlignment="Center">
+                                <Ellipse.Style>
+                                    <Style TargetType="Ellipse">
+                                        <Style.Triggers>
+                                            <DataTrigger Binding="{Binding socketStatus}" Value="Error">
+                                                <Setter Property="Shape.Fill" Value="Red"/>
+                                            </DataTrigger>
+                                            <DataTrigger Binding="{Binding socketStatus}" Value="Success">
+                                                <Setter Property="Shape.Fill" Value="Green"/>
+                                            </DataTrigger>
+                                        </Style.Triggers>
+                                    </Style>
+                                </Ellipse.Style>
+                            </Ellipse>
+                            <Label FontSize="12" Content="{Binding statusMessage}"/>
+                        </StackPanel>
+                    </StatusBar>
+                </Grid>
+            </AdornerDecorator>
+        </Grid>
+    </Border>
 </Window>

--
Gitblit v1.9.1