refactor: 将Framework库和RT、UI放在同一个解决方案中。
This commit is contained in:
@@ -0,0 +1,955 @@
|
||||
<UserControl
|
||||
x:Class="MECF.Framework.UI.Client.CenterViews.DataLogs.Event.EventView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:micro="clr-namespace:Caliburn.Micro"
|
||||
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:userControls1="clr-namespace:Sicentury.Core.UserControls;assembly=Sicentury.Core"
|
||||
xmlns:cv="clr-namespace:MECF.Framework.UI.Core.Converters;assembly=MECF.Framework.UI.Core"
|
||||
xmlns:lex="http://wpflocalizeextension.codeplex.com"
|
||||
Name="uc"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400"
|
||||
mc:Ignorable="d"
|
||||
lex:LocalizeDictionary.DesignCulture="en"
|
||||
lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_common">
|
||||
<UserControl.Resources>
|
||||
|
||||
<cv:BoolReverseConverter x:Key="boolReverseConverter" />
|
||||
<cv:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
|
||||
|
||||
|
||||
<Style x:Key="{x:Type userControls1:CirclePointRingLoading}"
|
||||
TargetType="{x:Type userControls1:CirclePointRingLoading}">
|
||||
<Setter Property="Foreground" Value="#FFFFFFFF" />
|
||||
<Setter Property="UIElement.IsHitTestVisible" Value="False" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="MinHeight" Value="20" />
|
||||
<Setter Property="MinWidth" Value="20" />
|
||||
<Setter Property="Height" Value="60" />
|
||||
<Setter Property="Width" Value="60" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type userControls1:CirclePointRingLoading}">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}">
|
||||
<FrameworkElement.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style x:Key="ProgressRingEllipseStyle" TargetType="{x:Type Ellipse}">
|
||||
<Setter Property="UIElement.Opacity" Value="0" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Top" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</FrameworkElement.Resources>
|
||||
<Grid
|
||||
Name="Ring"
|
||||
MaxWidth="{Binding MaxSideLength, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
MaxHeight="{Binding MaxSideLength, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
FlowDirection="LeftToRight"
|
||||
RenderTransformOrigin=".5,.5"
|
||||
Visibility="Visible">
|
||||
<Canvas RenderTransformOrigin=".5,.5">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E1R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E1"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
<Canvas RenderTransformOrigin=".5,.5">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E2R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E2"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
<Canvas RenderTransformOrigin=".5,.5">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E3R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E3"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
<Canvas RenderTransformOrigin=".5,.5">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E4R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E4"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
<Canvas RenderTransformOrigin=".5,.5">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E5R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E5"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
<Canvas
|
||||
Name="SixthCircle"
|
||||
RenderTransformOrigin=".5,.5"
|
||||
Visibility="Collapsed">
|
||||
<UIElement.RenderTransform>
|
||||
<RotateTransform x:Name="E6R" />
|
||||
</UIElement.RenderTransform>
|
||||
<Ellipse
|
||||
Name="E6"
|
||||
Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
|
||||
Fill="{TemplateBinding Foreground}"
|
||||
Style="{StaticResource ProgressRingEllipseStyle}" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="SizeStates">
|
||||
<VisualState x:Name="Large">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetName="SixthCircle"
|
||||
Storyboard.TargetProperty="Visibility"
|
||||
Duration="0">
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<ObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</ObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Small" />
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="ActiveStates">
|
||||
<VisualState x:Name="Inactive" />
|
||||
<VisualState x:Name="Active">
|
||||
<Storyboard RepeatBehavior="Forever">
|
||||
<ObjectAnimationUsingKeyFrames
|
||||
Storyboard.TargetName="Ring"
|
||||
Storyboard.TargetProperty="Visibility"
|
||||
Duration="0">
|
||||
<DiscreteObjectKeyFrame KeyTime="0">
|
||||
<ObjectKeyFrame.Value>
|
||||
<Visibility>Visible</Visibility>
|
||||
</ObjectKeyFrame.Value>
|
||||
</DiscreteObjectKeyFrame>
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="0"
|
||||
Storyboard.TargetName="E1"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.167"
|
||||
Storyboard.TargetName="E2"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.334"
|
||||
Storyboard.TargetName="E3"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.501"
|
||||
Storyboard.TargetName="E4"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.668"
|
||||
Storyboard.TargetName="E5"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.835"
|
||||
Storyboard.TargetName="E6"
|
||||
Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="0"
|
||||
Storyboard.TargetName="E1R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-110" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="10" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="93" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="205" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="357" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="439" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="585" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.167"
|
||||
Storyboard.TargetName="E2R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-116" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="4" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="87" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="199" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="351" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="433" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="579" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.334"
|
||||
Storyboard.TargetName="E3R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-122" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="-2" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="81" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="193" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="345" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="427" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="573" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.501"
|
||||
Storyboard.TargetName="E4R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-128" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="-8" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="75" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="187" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="339" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="421" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="567" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.668"
|
||||
Storyboard.TargetName="E5R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-134" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="-14" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="69" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="181" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="331" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="415" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="561" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames
|
||||
BeginTime="00:00:00.835"
|
||||
Storyboard.TargetName="E6R"
|
||||
Storyboard.TargetProperty="Angle">
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.13,0.21,0.1,0.7"
|
||||
KeyTime="0"
|
||||
Value="-140" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.02,0.33,0.38,0.77"
|
||||
KeyTime="0:0:0.433"
|
||||
Value="-20" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="63" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.57,0.17,0.95,0.75"
|
||||
KeyTime="0:0:1.617"
|
||||
Value="175" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0.19,0.07,0.72"
|
||||
KeyTime="0:0:2.017"
|
||||
Value="325" />
|
||||
<SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="409" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0,0,0.95,0.37"
|
||||
KeyTime="0:0:3.217"
|
||||
Value="555" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid IsEnabled="{Binding IsPermission}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="260" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0">
|
||||
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="GroupBox">
|
||||
<Setter Property="Margin" Value="0,15,0,0" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="GroupBox">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Background="{StaticResource Table_BG_Title}"
|
||||
BorderBrush="{x:Null}"
|
||||
BorderThickness="1,1,1,0"
|
||||
CornerRadius="2,2,0,0">
|
||||
|
||||
<ContentPresenter
|
||||
Margin="4"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentSource="Header"
|
||||
RecognizesAccessKey="True" />
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Background="{StaticResource Table_BG_Content}"
|
||||
BorderThickness="1,0,1,1"
|
||||
CornerRadius="0,0,2,2">
|
||||
<ContentPresenter Margin="4" />
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<!-- Query Condition Card -->
|
||||
<GroupBox BorderThickness="1">
|
||||
<GroupBox.Header>
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Text="{lex:Loc ID_TXT_QueryCondition}" />
|
||||
</GroupBox.Header>
|
||||
<StackPanel Margin="0,5">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="toolkit:DateTimeUpDown">
|
||||
<Setter Property="Width" Value="170" />
|
||||
<Setter Property="Format" Value="Custom" />
|
||||
<Setter Property="FormatString" Value="yyyy/MM/dd HH:mm:ss" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="70"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource FG_Black}"
|
||||
Text="{lex:Loc ID_TXT_StartTime}" />
|
||||
<WindowsFormsHost
|
||||
Width="170"
|
||||
Height="22"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14">
|
||||
<forms:DateTimePicker
|
||||
x:Name="wfTimeFrom"
|
||||
CustomFormat="yyyy/MM/dd HH:mm:ss"
|
||||
Format="Custom"
|
||||
Value="2011-8-1" />
|
||||
</WindowsFormsHost>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,5,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="70"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
Foreground="{StaticResource FG_Black}"
|
||||
Text="{lex:Loc ID_TXT_EndTime}" />
|
||||
<WindowsFormsHost
|
||||
Width="170"
|
||||
Height="22"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14">
|
||||
<forms:DateTimePicker
|
||||
x:Name="wfTimeTo"
|
||||
CustomFormat="yyyy/MM/dd HH:mm:ss"
|
||||
Format="Custom"
|
||||
Value="2011-8-1" />
|
||||
</WindowsFormsHost>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
|
||||
<!-- Query Condition Card -->
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Text="{lex:Loc ID_TXT_QueryOption}" />
|
||||
</GroupBox.Header>
|
||||
<UniformGrid Margin="0,5" Columns="2">
|
||||
<CheckBox
|
||||
Content="{lex:Loc ID_TXT_Alarm}"
|
||||
FontSize="14"
|
||||
IsChecked="{Binding SearchAlarmEvent}" />
|
||||
<CheckBox
|
||||
Content="{lex:Loc ID_TXT_Warning}"
|
||||
FontSize="14"
|
||||
IsChecked="{Binding SearchWarningEvent}" />
|
||||
<CheckBox
|
||||
Content="{lex:Loc ID_TXT_Information}"
|
||||
FontSize="14"
|
||||
IsChecked="{Binding SearchInfoEvent}" />
|
||||
<!--<CheckBox Content="Operation" Height="Auto" IsChecked="{Binding SearchOpeLog}" FontSize="14" />-->
|
||||
</UniformGrid>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Extra Condition -->
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Text="{lex:Loc ID_TXT_ExtraCondition}" />
|
||||
</GroupBox.Header>
|
||||
<StackPanel Margin="0,5" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Name="checkBox3"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
Tag="ReactorC"
|
||||
Text="{lex:Loc ID_TXT_KeyWords}" />
|
||||
<TextBox
|
||||
Width="170"
|
||||
Margin="5,0,0,0"
|
||||
FontSize="14"
|
||||
Text="{Binding SearchKeyWords, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<!-- Query and Export Buttons Card -->
|
||||
<Grid
|
||||
Grid.Row="6"
|
||||
Margin="84,18,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
Content="{lex:Loc ID_TXT_Query}"
|
||||
FontFamily="Arial">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<micro:ActionMessage MethodName="Query">
|
||||
<micro:ActionMessage.Parameters>
|
||||
<!-- 首次查询 -->
|
||||
<micro:Parameter Value="-1" />
|
||||
<!-- 不包含Filter条件 -->
|
||||
<micro:Parameter Value="false" />
|
||||
</micro:ActionMessage.Parameters>
|
||||
</micro:ActionMessage>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="10,0,0,0">
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="9"
|
||||
Text="{lex:Loc ID_TXT_Loading}"
|
||||
Visibility="{Binding IsLoading, Converter={StaticResource BoolVisibilityConverter}}" />
|
||||
|
||||
<userControls1:CirclePointRingLoading
|
||||
Width="20"
|
||||
Height="20"
|
||||
Foreground="#3ca9fe"
|
||||
IsActive="True"
|
||||
IsLarge="True"
|
||||
Visibility="{Binding IsLoading, Converter={StaticResource BoolVisibilityConverter}}" />
|
||||
</Grid>
|
||||
|
||||
<Button
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="0,10,0,0"
|
||||
Content="{lex:Loc ID_BTN_Export_Content}"
|
||||
FontFamily="Arial">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<micro:ActionMessage MethodName="Export" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Exporting Progress State Info. Card -->
|
||||
<StackPanel
|
||||
Grid.Row="7"
|
||||
Height="30"
|
||||
Margin="60,5,0,0"
|
||||
Orientation="Horizontal"
|
||||
Visibility="{Binding IsExporting, Converter={StaticResource BoolVisibilityConverter}}">
|
||||
<userControls1:CirclePointRingLoading
|
||||
Width="16"
|
||||
Height="16"
|
||||
Foreground="#3ca9fe"
|
||||
IsActive="True"
|
||||
IsLarge="True" />
|
||||
<TextBlock
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="9"
|
||||
Text="{Binding ExportingMessage}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Filter Condition Card -->
|
||||
<GroupBox>
|
||||
<GroupBox.Header>
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Text="{lex:Loc ID_TXT_FilterCondition}" />
|
||||
</GroupBox.Header>
|
||||
<StackPanel Margin="0,5">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Name="checkBox"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
Tag="ReactorC"
|
||||
Text="{lex:Loc ID_TXT_System}" />
|
||||
<toolkit:CheckComboBox
|
||||
x:Name="ccbxFilterEventSource"
|
||||
Width="170"
|
||||
Height="25"
|
||||
Margin="26,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
ItemSelectionChanged="ccbxFilterEventSource_ItemSelectionChanged"
|
||||
ItemsSource="{Binding FilterEventSources}"
|
||||
SelectedItemsOverride="{Binding SelectedFilterEventSource, Delay=10}"
|
||||
SelectedValue="{Binding SelectedValueLP, Delay=10}"
|
||||
ToolTip="{Binding ElementName=tbLoadPort1, Path=SelectedValue}">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="ItemSelectionChanged">
|
||||
<i:InvokeCommandAction Command="{Binding tbLoadPort1SelectionChangedCommand}"
|
||||
CommandParameter="{Binding ElementName=uc, Path=tbLoadPort1ToolTipValueData}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</toolkit:CheckComboBox>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0,5,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Name="checkBox9"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Arial"
|
||||
FontSize="14"
|
||||
Tag="ReactorC"
|
||||
Text="{lex:Loc ID_TXT_KeyWords}" />
|
||||
<TextBox
|
||||
Width="170"
|
||||
Margin="5,0,0,0"
|
||||
FontSize="14"
|
||||
Text="{Binding FilterKeyWords}" />
|
||||
</StackPanel>
|
||||
<!--<CheckBox IsThreeState="True" Width="100" Height="30" Margin="0,10,0,0" FontFamily="Arial" Content="ALL"/>-->
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
Margin="0,10,0,0"
|
||||
Content="{lex:Loc ID_TXT_Filter}"
|
||||
FontFamily="Arial">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<micro:ActionMessage MethodName="Query">
|
||||
<micro:ActionMessage.Parameters>
|
||||
<!-- 首次查询 -->
|
||||
<micro:Parameter Value="-1" />
|
||||
<!-- 包含Filter条件 -->
|
||||
<micro:Parameter Value="true" />
|
||||
</micro:ActionMessage.Parameters>
|
||||
</micro:ActionMessage>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
<Grid Grid.Column="1" Margin="10,0,0,0" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="{lex:Loc ID_TXT_Show}" />
|
||||
|
||||
<ComboBox
|
||||
Width="100"
|
||||
Height="23"
|
||||
Margin="5,0,0,0"
|
||||
FontSize="13"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}"
|
||||
ItemsSource="{Binding PaginationCapacity}"
|
||||
SelectedItem="{Binding SelectedPaginationCapacity}" />
|
||||
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Margin="5,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="{lex:Loc ID_TXT_ItemsPerPage}" />
|
||||
|
||||
<Button
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Height="29"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding NavigateCommand}"
|
||||
CommandParameter="first"
|
||||
Content="{lex:Loc ID_BTN_First_Content}"
|
||||
FontFamily="Arial,SimSun"
|
||||
FontSize="15"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}" />
|
||||
|
||||
<Button
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Height="29"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding NavigateCommand}"
|
||||
CommandParameter="previous"
|
||||
Content="{lex:Loc ID_BTN_Previous_Content}"
|
||||
FontFamily="Arial,SimSun"
|
||||
FontSize="15"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}" />
|
||||
|
||||
<TextBlock
|
||||
Width="100"
|
||||
Margin="10,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="{Binding PageInfo}"
|
||||
TextAlignment="Center" />
|
||||
|
||||
|
||||
<Button
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Height="29"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding NavigateCommand}"
|
||||
CommandParameter="next"
|
||||
Content="{lex:Loc ID_BTN_Next_Content}"
|
||||
FontFamily="Arial,SimSun"
|
||||
FontSize="15"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}" />
|
||||
|
||||
<Button
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Height="29"
|
||||
Margin="10,0,0,0"
|
||||
Command="{Binding NavigateCommand}"
|
||||
CommandParameter="last"
|
||||
Content="{lex:Loc ID_BTN_Last_Content}"
|
||||
FontFamily="Arial,SimSun"
|
||||
FontSize="15"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}" />
|
||||
|
||||
<TextBlock
|
||||
lex:ResxLocalizationProvider.DefaultDictionary="lang_datalogviews"
|
||||
Margin="20,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Text="{lex:Loc ID_TXT_QuickGoTo}" />
|
||||
|
||||
<ComboBox
|
||||
Width="100"
|
||||
Height="25"
|
||||
Margin="5,0,0,0"
|
||||
FontSize="13"
|
||||
IsEnabled="{Binding IsLoading, Converter={StaticResource boolReverseConverter}}"
|
||||
ItemsSource="{Binding Path=PaginationSource, Mode=OneWay}"
|
||||
SelectedValue="{Binding Path=SelectedPage, Mode=TwoWay, Delay=10}" />
|
||||
</StackPanel>
|
||||
<DataGrid Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
FontSize="13"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding SearchedResult, Mode=OneWay}"
|
||||
SelectionMode="Single"
|
||||
SelectionUnit="FullRow"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn
|
||||
Width="40"
|
||||
CanUserSort="True"
|
||||
SortMemberPath="Icon">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Image
|
||||
Width="20"
|
||||
Height="20"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Source="{Binding Icon}"
|
||||
Stretch="Fill" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="70"
|
||||
Binding="{Binding LogType, Mode=OneWay}"
|
||||
CanUserReorder="False"
|
||||
CanUserResize="False"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True">
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{lex:Loc ID_TXT_Type}"
|
||||
TextAlignment="Center" />
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="200"
|
||||
Binding="{Binding Time, Mode=OneWay}"
|
||||
CanUserReorder="True"
|
||||
CanUserResize="False"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True">
|
||||
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{lex:Loc ID_TXT_Date}"
|
||||
TextAlignment="Left" />
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding TargetChamber, Mode=OneWay}"
|
||||
CanUserReorder="False"
|
||||
CanUserResize="False"
|
||||
CanUserSort="True"
|
||||
IsReadOnly="True">
|
||||
|
||||
<DataGridTextColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{lex:Loc ID_TXT_System}"
|
||||
TextAlignment="Center" />
|
||||
</DataTemplate>
|
||||
</DataGridTextColumn.HeaderTemplate>
|
||||
<DataGridTextColumn.ElementStyle>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="TextAlignment" Value="Left" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</DataGridTextColumn.ElementStyle>
|
||||
</DataGridTextColumn>
|
||||
|
||||
|
||||
<DataGridTemplateColumn
|
||||
Width="*"
|
||||
CanUserReorder="False"
|
||||
CanUserResize="False"
|
||||
CanUserSort="True"
|
||||
Header="Description"
|
||||
IsReadOnly="True">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{lex:Loc ID_TXT_Description}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Detail}"
|
||||
TextWrapping="Wrap" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,69 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// EventView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public delegate void ItemSelectionChange(bool changeFalg);
|
||||
|
||||
public class ItemSelectionData
|
||||
{
|
||||
public bool _IsSelcet;
|
||||
public string _SelectItem;
|
||||
|
||||
public bool IsSelect
|
||||
{
|
||||
get => _IsSelcet;
|
||||
set => _IsSelcet = value;
|
||||
}
|
||||
|
||||
public string SelectItem
|
||||
{
|
||||
get => _SelectItem;
|
||||
set => _SelectItem = value;
|
||||
}
|
||||
|
||||
public ItemSelectionData(bool IsSelcet, string SelectItem)
|
||||
{
|
||||
this.IsSelect = IsSelcet;
|
||||
this.SelectItem = SelectItem;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class EventView : UserControl
|
||||
{
|
||||
public EventView()
|
||||
{
|
||||
InitializeComponent();
|
||||
tbLoadPort1ToolTipList = new List<string>();
|
||||
}
|
||||
|
||||
public List<string> tbLoadPort1ToolTipList { get; set; }
|
||||
|
||||
public static readonly DependencyProperty tbLoadPort1ToolTipValueProperty = DependencyProperty.Register(
|
||||
"tbLoadPort1ToolTipValueData", typeof(ItemSelectionData), typeof(EventView));
|
||||
|
||||
public ItemSelectionData tbLoadPort1ToolTipValueData
|
||||
{
|
||||
get => (ItemSelectionData)this.GetValue(tbLoadPort1ToolTipValueProperty);
|
||||
set => SetValue(tbLoadPort1ToolTipValueProperty, value);
|
||||
}
|
||||
|
||||
private void ccbxFilterEventSource_ItemSelectionChanged(object sender,
|
||||
Xceed.Wpf.Toolkit.Primitives.ItemSelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Item != null)
|
||||
{
|
||||
tbLoadPort1ToolTipValueData = new ItemSelectionData(e.IsSelected, e.Item.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
tbLoadPort1ToolTipValueData = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,890 @@
|
||||
using Aitex.Core.RT.Event;
|
||||
using Aitex.Core.RT.Log;
|
||||
using MECF.Framework.Common.DataCenter;
|
||||
using MECF.Framework.Common.Utilities;
|
||||
using MECF.Framework.UI.Client.ClientBase;
|
||||
using OpenSEMI.ClientBase.Command;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Caliburn.Micro.Core;
|
||||
using OpenSEMI.ClientBase;
|
||||
using Sicentury.Core.Collections;
|
||||
|
||||
namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
|
||||
{
|
||||
public class EventViewModel : BaseModel
|
||||
{
|
||||
#region Variables
|
||||
|
||||
/// <summary>
|
||||
/// 首次查询。需要计算总页码等参数。
|
||||
/// </summary>
|
||||
private const int QUERY_FIRST_TIME = -1;
|
||||
|
||||
/// <summary>
|
||||
/// 一次性查询所有数据,EXCEL导出使用。
|
||||
/// </summary>
|
||||
private const int QUERY_FOR_EXCEL_EXPORT = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 指示函数<see cref="tbLoadPort1Selection"/>是否发生了重入。如果发生重入,说明“ALL”由
|
||||
/// 后台程序勾选,此时不要进行任何逻辑操作,仅设置”ALL“的选择状态。
|
||||
/// 重入的情况发生在:
|
||||
/// 1. 所有选项全部被选中
|
||||
/// 2. 此时将“ALL”以外的选项勾掉
|
||||
/// 3. “ALL”自动取消选择
|
||||
/// 上述2会触发3,引起函数重入。
|
||||
/// </summary>
|
||||
private bool _isEventSourceFilterSelectionReentered = false;
|
||||
|
||||
private int _currentPage;
|
||||
private int _totalPage;
|
||||
private int _selectedPage;
|
||||
private int _selectedPaginationCapacity;
|
||||
private bool _isLoading;
|
||||
private bool _isExporting;
|
||||
private string _exportingMessage;
|
||||
|
||||
/// <summary>
|
||||
/// 显示查询到的事件日志列表。
|
||||
/// </summary>
|
||||
private readonly IProgress<List<EventItem>> _progShowSearchingResult;
|
||||
|
||||
/// <summary>
|
||||
/// 构造Event Source列表。
|
||||
/// </summary>
|
||||
private readonly IProgress<List<string>> _progConstructEventSourcesList;
|
||||
|
||||
/// <summary>
|
||||
/// 更新分页信息。
|
||||
/// <para>Tuple.Item1: 当前页号</para>
|
||||
/// <para>Tuple.Item2: 总页号;设置为-1时表示忽略更新总页号。</para>
|
||||
/// </summary>
|
||||
private readonly IProgress<Tuple<int, int>> _progUpdatePaginationInfo;
|
||||
|
||||
/// <summary>
|
||||
/// 更新查询状态。
|
||||
/// </summary>
|
||||
private readonly IProgress<bool> _progUpdateQueryStatus;
|
||||
|
||||
/// <summary>
|
||||
/// 更新日志导出状态。
|
||||
/// <para>Tuple.Item1: 导出进度,0~100</para>
|
||||
/// <para>Tuple.Item2: 消息</para>
|
||||
/// </summary>
|
||||
private readonly IProgress<Tuple<int, string>> _progUpdateExportingState;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
public EventViewModel()
|
||||
{
|
||||
DisplayName = "Event";
|
||||
|
||||
QueryEventList = () =>
|
||||
{
|
||||
var result = new List<string>();
|
||||
|
||||
foreach (var eventName in Enum.GetNames(typeof(EventEnum)))
|
||||
result.Add(eventName);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
SearchedResult = new ObservableRangeCollection<SystemLogItem>();
|
||||
FilterEventSources = new ObservableRangeCollection<string>();
|
||||
SelectedFilterEventSource = new ObservableRangeCollection<string>();
|
||||
PaginationSource = new ObservableRangeCollection<int>();
|
||||
|
||||
SearchKeyWords = string.Empty;
|
||||
|
||||
SearchAlarmEvent = true;
|
||||
SearchWarningEvent = true;
|
||||
SearchInfoEvent = true;
|
||||
SearchOpeLog = false;
|
||||
|
||||
SearchPMA = false;
|
||||
SearchPMB = false;
|
||||
SearchPMC = false;
|
||||
SearchPMD = false;
|
||||
SearchTM = false;
|
||||
SearchLL = false;
|
||||
SearchSystem = false;
|
||||
|
||||
tbLoadPort1SelectionChangedCommand = new BaseCommand<object>(tbLoadPort1Selection);
|
||||
|
||||
|
||||
// 分页支持的每页Log数量
|
||||
//! 最小每页条目数使用30,以保证正好显示一页而不出现纵向滚动条。
|
||||
PaginationCapacity = new List<int>
|
||||
{
|
||||
30,
|
||||
300,
|
||||
3000
|
||||
};
|
||||
|
||||
_selectedPaginationCapacity = PaginationCapacity.Last();
|
||||
_totalPage = 1;
|
||||
_currentPage = 1;
|
||||
|
||||
NavigateCommand = new BaseCommand<string>(Navigate, (o) => true);
|
||||
|
||||
#region 显示查询到的EventLog列表
|
||||
|
||||
_progShowSearchingResult = new Progress<List<EventItem>>((queryRet =>
|
||||
{
|
||||
if (SearchedResult == null)
|
||||
SearchedResult = new ObservableRangeCollection<SystemLogItem>();
|
||||
else
|
||||
SearchedResult.Clear();
|
||||
|
||||
SearchedResult.AddRange(queryRet.Select(x =>
|
||||
new SystemLogItem()
|
||||
{
|
||||
Time = (x.OccuringTime).ToString("yyyy/MM/dd HH:mm:ss.fff"),
|
||||
LogType = x.Level.ToString(),
|
||||
Detail = x.Description,
|
||||
TargetChamber = x.Source,
|
||||
Initiator = "",
|
||||
Icon = new BitmapImage(new Uri(
|
||||
$"pack://application:,,,/MECF.Framework.UI.Core;component/Resources/SystemLog/{x.Level}.png",
|
||||
UriKind.Absolute))
|
||||
}
|
||||
));
|
||||
}));
|
||||
|
||||
#endregion
|
||||
|
||||
#region 构造Event Sources列表
|
||||
|
||||
_progConstructEventSourcesList = new Progress<List<string>>((list =>
|
||||
{
|
||||
SelectedFilterEventSource.Clear();
|
||||
FilterEventSources.Clear();
|
||||
|
||||
SelectedFilterEventSource.Add("ALL");
|
||||
FilterEventSources.Add("ALL");
|
||||
|
||||
SelectedFilterEventSource.AddRange(list);
|
||||
FilterEventSources.AddRange(list);
|
||||
|
||||
}));
|
||||
|
||||
#endregion
|
||||
|
||||
#region 更新分页信息
|
||||
|
||||
_progUpdatePaginationInfo = new Progress<Tuple<int, int>>(pageInfo =>
|
||||
{
|
||||
_currentPage = pageInfo.Item1;
|
||||
|
||||
if (pageInfo.Item2 > 0)
|
||||
{
|
||||
_totalPage = pageInfo.Item2;
|
||||
PaginationSource.Clear();
|
||||
PaginationSource.AddRange(Enumerable.Range(1, _totalPage));
|
||||
NotifyOfPropertyChange(nameof(PaginationSource));
|
||||
}
|
||||
|
||||
NotifyOfPropertyChange(nameof(PageInfo));
|
||||
|
||||
_selectedPage = _currentPage;
|
||||
NotifyOfPropertyChange(nameof(SelectedPage));
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region 更新查询状态
|
||||
|
||||
_progUpdateQueryStatus = new Progress<bool>(isBusy =>
|
||||
{
|
||||
IsLoading = isBusy;
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region 更新日志导出进度信息
|
||||
|
||||
_progUpdateExportingState = new Progress<Tuple<int, string>>(state =>
|
||||
{
|
||||
var progress = state.Item1;
|
||||
var message = state.Item2;
|
||||
|
||||
switch (progress)
|
||||
{
|
||||
case 0:
|
||||
IsExporting = true;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
IsExporting = false;
|
||||
break;
|
||||
}
|
||||
|
||||
ExportingMessage = message;
|
||||
});
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public bool SearchAlarmEvent { get; set; }
|
||||
|
||||
public bool SearchWarningEvent { get; set; }
|
||||
|
||||
public bool SearchInfoEvent { get; set; }
|
||||
|
||||
public bool SearchOpeLog { get; set; }
|
||||
|
||||
public bool SearchPMA { get; set; }
|
||||
|
||||
public bool SearchPMB { get; set; }
|
||||
|
||||
public bool SearchPMC { get; set; }
|
||||
|
||||
public bool SearchPMD { get; set; }
|
||||
|
||||
//public bool SearchCoolDown { get; set; }
|
||||
public bool SearchTM { get; set; }
|
||||
|
||||
public bool SearchLL { get; set; }
|
||||
|
||||
//public bool SearchBuf1 { get; set; }
|
||||
public bool SearchSystem { get; set; }
|
||||
|
||||
public string SearchKeyWords { get; set; }
|
||||
|
||||
public string FilterKeyWords { get; set; }
|
||||
|
||||
public DateTime SearchBeginTime
|
||||
{
|
||||
get => ((EventView)view).wfTimeFrom.Value;
|
||||
set
|
||||
{
|
||||
((EventView)view).wfTimeFrom.Value = value;
|
||||
NotifyOfPropertyChange(nameof(SearchBeginTime));
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime SearchEndTime
|
||||
{
|
||||
get => ((EventView)view).wfTimeTo.Value;
|
||||
set
|
||||
{
|
||||
((EventView)view).wfTimeTo.Value = value;
|
||||
NotifyOfPropertyChange(nameof(SearchEndTime));
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> EventList { get; set; }
|
||||
|
||||
public string SelectedEvent { get; set; }
|
||||
|
||||
public ObservableRangeCollection<SystemLogItem> SearchedResult { get; private set; }
|
||||
|
||||
public Func<List<string>> QueryEventList { get; set; }
|
||||
|
||||
|
||||
private EventView view;
|
||||
|
||||
public ObservableRangeCollection<string> FilterEventSources { get; set; }
|
||||
|
||||
public ObservableRangeCollection<string> SelectedFilterEventSource { get; set; }
|
||||
|
||||
public ICommand tbLoadPort1SelectionChangedCommand { get; set; }
|
||||
//public ICommand tbLoadPort2SelectionChangedCommand { get; set; }
|
||||
|
||||
public ICommand NavigateCommand { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回受支持的分页每页容量。
|
||||
/// </summary>
|
||||
public List<int> PaginationCapacity { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 页码列表,用于快速跳转页面下拉框数据源。
|
||||
/// </summary>
|
||||
public ObservableRangeCollection<int> PaginationSource { get; }
|
||||
|
||||
public int SelectedPage
|
||||
{
|
||||
get => _selectedPage;
|
||||
set
|
||||
{
|
||||
_selectedPage = value;
|
||||
Query(_selectedPage);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回选择的分页每页容量。
|
||||
/// </summary>
|
||||
public int SelectedPaginationCapacity
|
||||
{
|
||||
get => _selectedPaginationCapacity;
|
||||
set
|
||||
{
|
||||
_selectedPaginationCapacity = value;
|
||||
Query();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 页码信息。
|
||||
/// </summary>
|
||||
public string PageInfo => $"{_currentPage}/{_totalPage}";
|
||||
|
||||
/// <summary>
|
||||
/// 返回是否正在加载数据。
|
||||
/// </summary>
|
||||
public bool IsLoading
|
||||
{
|
||||
get => _isLoading;
|
||||
set
|
||||
{
|
||||
_isLoading = value;
|
||||
NotifyOfPropertyChange(nameof(IsLoading));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否正在导出数据。
|
||||
/// </summary>
|
||||
public bool IsExporting
|
||||
{
|
||||
get => _isExporting;
|
||||
private set
|
||||
{
|
||||
_isExporting = value;
|
||||
NotifyOfPropertyChange(nameof(IsExporting));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出进度消息。
|
||||
/// </summary>
|
||||
public string ExportingMessage
|
||||
{
|
||||
get => _exportingMessage;
|
||||
private set
|
||||
{
|
||||
_exportingMessage = value;
|
||||
NotifyOfPropertyChange(nameof(ExportingMessage));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Navigate(string args)
|
||||
{
|
||||
switch (args)
|
||||
{
|
||||
case "first":
|
||||
if (_currentPage == 1)
|
||||
return;
|
||||
_currentPage = 1;
|
||||
break;
|
||||
|
||||
case "previous":
|
||||
if(_currentPage > 1)
|
||||
_currentPage--;
|
||||
break;
|
||||
|
||||
case "next":
|
||||
if(_currentPage < _totalPage)
|
||||
_currentPage++;
|
||||
break;
|
||||
|
||||
case "last":
|
||||
if (_currentPage == _totalPage)
|
||||
return;
|
||||
_currentPage = _totalPage;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
Query(_currentPage);
|
||||
}
|
||||
|
||||
protected override void OnViewLoaded(object view)
|
||||
{
|
||||
base.OnViewLoaded(view);
|
||||
|
||||
// 默认的查询时间设置为当天
|
||||
this.view = (EventView)view;
|
||||
SearchBeginTime = DateTime.Today;
|
||||
SearchEndTime = DateTime.Today.AddDays(1).AddTicks(-1);
|
||||
Preload();
|
||||
}
|
||||
|
||||
public void Preload()
|
||||
{
|
||||
EventList = new List<string> { "All" };
|
||||
|
||||
if (QueryEventList != null)
|
||||
{
|
||||
var evList = QueryEventList();
|
||||
foreach (var ev in evList)
|
||||
EventList.Add(ev);
|
||||
}
|
||||
|
||||
SelectedEvent = "All";
|
||||
|
||||
Query();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event Source中全选和全不选逻辑实现。
|
||||
/// <see cref="_isEventSourceFilterSelectionReentered"/>
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public void tbLoadPort1Selection(object o)
|
||||
{
|
||||
if (_isEventSourceFilterSelectionReentered)
|
||||
return;
|
||||
|
||||
_isEventSourceFilterSelectionReentered = true;
|
||||
|
||||
if (o is ItemSelectionData item)
|
||||
{
|
||||
if (item.SelectItem == "ALL")
|
||||
{
|
||||
//if (isAllSelectedInBackend)
|
||||
// return;
|
||||
|
||||
if (item.IsSelect)
|
||||
{
|
||||
SelectedFilterEventSource.Clear();
|
||||
SelectedFilterEventSource.AddRange(FilterEventSources);
|
||||
//FilterEventSources.ToList().ForEach(sp =>
|
||||
//{
|
||||
// if (!SelectedFilterEventSource.Contains(sp))
|
||||
// SelectedFilterEventSource.Add(sp);
|
||||
//});
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedFilterEventSource.Clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 判断是否需要取消或选中“ALL”
|
||||
var list =
|
||||
FilterEventSources
|
||||
.Except(new[] {"ALL"})
|
||||
.Except(SelectedFilterEventSource.Except(new [] {"ALL"}))
|
||||
.ToList();
|
||||
|
||||
//isAllSelectedInBackend = true;
|
||||
|
||||
if (list.Any())
|
||||
{
|
||||
if (SelectedFilterEventSource.Contains("ALL"))
|
||||
SelectedFilterEventSource.Remove("ALL");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedFilterEventSource.Clear();
|
||||
SelectedFilterEventSource.AddRange(FilterEventSources);
|
||||
//FilterEventSources.ToList().ForEach(sp =>
|
||||
//{
|
||||
// if (!SelectedFilterEventSource.Contains(sp))
|
||||
// SelectedFilterEventSource.Add(sp);
|
||||
//});
|
||||
}
|
||||
|
||||
//isAllSelectedInBackend = false;
|
||||
}
|
||||
}
|
||||
|
||||
_isEventSourceFilterSelectionReentered = false;
|
||||
}
|
||||
|
||||
private string GetSourceWhere()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
#region 数据库查询相关函数
|
||||
|
||||
#region SQL 语句构造函数
|
||||
|
||||
/// <summary>
|
||||
/// 获取EventLog查询语句中select部分表达式。
|
||||
/// </summary>
|
||||
private string GetEventLogQuerySql()
|
||||
{
|
||||
return
|
||||
"SELECT \"event_id\", \"event_enum\", \"type\", \"occur_time\", \"level\",\"source\" , \"description\" FROM \"event_data\"" +
|
||||
GetWhereTimeRangeExpression();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取EventLog行数查询语句中select部分表达式。
|
||||
/// </summary>
|
||||
private string GetEventLogCountSql()
|
||||
{
|
||||
return
|
||||
"SELECT COUNT(1) FROM \"event_data\"" + GetWhereTimeRangeExpression(); ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取EventLog行数查询语句中select部分表达式。
|
||||
/// </summary>
|
||||
private string GetChamberListSql()
|
||||
{
|
||||
return
|
||||
"SELECT DISTINCT \"source\" FROM \"event_data\"" + GetWhereTimeRangeExpression();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WHERE条件中的“时间范围”子句。
|
||||
/// <para>注意:所有Select语句构造时必须包含TimeRange条件。</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWhereTimeRangeExpression()
|
||||
{
|
||||
|
||||
var sql = new StringBuilder(
|
||||
$" WHERE \"occur_time\" BETWEEN '{SearchBeginTime:yyyy/MM/dd HH:mm:ss}' AND '{SearchEndTime:yyyy/MM/dd HH:mm:ss}'");
|
||||
|
||||
return sql.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WHERE条件中的“Log Level”子句。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWhereLevelExpression()
|
||||
{
|
||||
var sqlLevelConditions = new List<string>();
|
||||
if (SearchInfoEvent)
|
||||
sqlLevelConditions.Add("'Information'");
|
||||
|
||||
if (SearchWarningEvent)
|
||||
sqlLevelConditions.Add("'Warning'");
|
||||
|
||||
if (SearchAlarmEvent)
|
||||
sqlLevelConditions.Add("'Alarm'");
|
||||
|
||||
return $" AND (\"level\" in ({string.Join(",", sqlLevelConditions)}))";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WHERE条件中的“关键字”子句。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWhereQueryKeyWordsExpression()
|
||||
{
|
||||
return string.IsNullOrEmpty(SearchKeyWords)
|
||||
? ""
|
||||
: $" AND (lower(\"description\") like lower('%{SearchKeyWords}%'))";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WHERE条件中的“事件类型过滤条件“子句。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWhereFilterEventSourceExpression()
|
||||
{
|
||||
if (SelectedFilterEventSource == null || SelectedFilterEventSource.Count <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(SelectedFilterEventSource),
|
||||
"no event source(s) in filter are selected.");
|
||||
|
||||
if (SelectedFilterEventSource.Contains("ALL"))
|
||||
return "";
|
||||
|
||||
return $" AND (\"source\" in ({string.Join(",", SelectedFilterEventSource.Select(x => $"'{x}'"))}))";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取WHERE条件中的“事件描述关键字过滤条件“子句。
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetWhereFilterEventKeywordExpression()
|
||||
{
|
||||
return string.IsNullOrEmpty(FilterKeyWords)
|
||||
? ""
|
||||
: $" AND (lower(\"description\") like lower('%{FilterKeyWords}%'))";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取SQL查询语句中的分页表达式。
|
||||
/// </summary>
|
||||
/// <param name="countPerPage"></param>
|
||||
/// <param name="currentPage"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
private string GetPaginationExpression(int countPerPage, int currentPage)
|
||||
{
|
||||
if (countPerPage <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(countPerPage),
|
||||
"the amount items per page can not be less than 1.");
|
||||
|
||||
if (currentPage <= 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(currentPage),
|
||||
"the current page required can not be less than 1.");
|
||||
|
||||
|
||||
|
||||
return $" ORDER BY \"occur_time\" LIMIT {countPerPage} OFFSET {countPerPage * (currentPage - 1)}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 查询当前条件下共有多少行数据。
|
||||
/// <param name="isIncludeFilter">是否包含过滤条件。</param>
|
||||
/// </summary>
|
||||
private int QueryRowAmount(bool isIncludeFilter)
|
||||
{
|
||||
var sql = GetEventLogCountSql()
|
||||
+ GetWhereLevelExpression()
|
||||
+ GetWhereQueryKeyWordsExpression();
|
||||
|
||||
if (isIncludeFilter)
|
||||
sql += GetWhereFilterEventSourceExpression()
|
||||
+ GetWhereFilterEventKeywordExpression();
|
||||
|
||||
var dt = QueryDataClient.Instance.Service.QueryData(sql);
|
||||
|
||||
// 未查询到任何数据。
|
||||
if (dt == null || dt.Rows.Count <= 0 || dt.Columns.Count <= 0)
|
||||
return 0;
|
||||
|
||||
// 返回满足当前条件的行数。
|
||||
return int.Parse(dt.Rows[0][0].ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询Event源列表。
|
||||
/// <para>注意:该查询仅在首次查询时使用;语句的条件仅只用时间范围和事件类型,不包含Filter选项。</para>
|
||||
/// <para>当套用Filter选项查询、或分页查询时,不再重构Event源列表。</para>
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private List<string> QueryEventSources()
|
||||
{
|
||||
var chamberList = new List<string>();
|
||||
|
||||
var sql = GetChamberListSql() + GetWhereLevelExpression();
|
||||
var dt = QueryDataClient.Instance.Service.QueryData(sql);
|
||||
|
||||
// 未查询到任何数据。
|
||||
if (dt == null || dt.Rows.Count <= 0 || dt.Columns.Count <= 0)
|
||||
return chamberList;
|
||||
|
||||
// 返回满足当前条件的行数。
|
||||
chamberList.AddRange(from DataRow row in dt.Rows select row[0].ToString());
|
||||
|
||||
return chamberList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询符合条件的事件日志。
|
||||
/// </summary>
|
||||
/// <param name="page">待查询页码。0:查询所有数据而不分页;其它:查询指定的页码。</param>
|
||||
/// <param name="isIncludeFilter">是否包含过滤条件。</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException">页码错误,页码必须为大于等于0的整数。</exception>
|
||||
/// <returns></returns>
|
||||
private List<EventItem> QueryEventLogs(int page, bool isIncludeFilter)
|
||||
{
|
||||
if (page < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(page), "the page number must be greater than 0.");
|
||||
|
||||
var sql = GetEventLogQuerySql()
|
||||
+ GetWhereLevelExpression()
|
||||
+ GetWhereQueryKeyWordsExpression();
|
||||
|
||||
if (isIncludeFilter)
|
||||
sql += GetWhereFilterEventSourceExpression()
|
||||
+ GetWhereFilterEventKeywordExpression();
|
||||
|
||||
// page == 0 表示查询所有数据,仅导出Excel时使用。
|
||||
if(page > 0)
|
||||
sql += GetPaginationExpression(SelectedPaginationCapacity, page);
|
||||
|
||||
return QueryDataClient.Instance.Service.QueryDBEvent(sql);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询数据。
|
||||
/// </summary>
|
||||
/// <param name="page">待查询的页号</param>
|
||||
/// <param name="isIncludeFilter">是否包含过滤条件。</param>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public void Query(int page = QUERY_FIRST_TIME, bool isIncludeFilter = false)
|
||||
{
|
||||
if (IsLoading)
|
||||
return;
|
||||
|
||||
if (SearchBeginTime > SearchEndTime)
|
||||
{
|
||||
DialogBox.ShowError("Time range invalid, start time should be early than end time");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var searchingResult = new List<EventItem>();
|
||||
|
||||
try
|
||||
{
|
||||
// 查询开始
|
||||
_progUpdateQueryStatus.Report(true);
|
||||
|
||||
if (page <= QUERY_FIRST_TIME) // Query按钮按下,或首次加载界面
|
||||
{
|
||||
// 统计总页数
|
||||
var rowCount = QueryRowAmount(isIncludeFilter);
|
||||
|
||||
var totalPage = (int)Math.Ceiling(rowCount / (double)SelectedPaginationCapacity);
|
||||
|
||||
// 首次查询第一页
|
||||
searchingResult = QueryEventLogs(1, isIncludeFilter);
|
||||
|
||||
if (isIncludeFilter == false)
|
||||
{
|
||||
// 构造Event Sources列表,仅在首次查询时构造
|
||||
var eventSources = QueryEventSources();
|
||||
_progConstructEventSourcesList.Report(eventSources);
|
||||
}
|
||||
|
||||
// 更新页面信息
|
||||
_progUpdatePaginationInfo.Report(new Tuple<int, int>(1, totalPage));
|
||||
|
||||
|
||||
}
|
||||
else if (page == QUERY_FOR_EXCEL_EXPORT)
|
||||
{
|
||||
|
||||
}
|
||||
else if (page >= 1)
|
||||
{
|
||||
// 翻页按钮按下
|
||||
searchingResult = QueryEventLogs(page, isIncludeFilter);
|
||||
|
||||
// 更新页面信息
|
||||
_progUpdatePaginationInfo.Report(new Tuple<int, int>(page, -1));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(page), "invalid page number.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
searchingResult.Clear();
|
||||
Execute.OnUIThread(() =>
|
||||
{
|
||||
DialogBox.ShowError($"Failed to query event log, {ex.Message}");
|
||||
});
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 显示结果
|
||||
_progShowSearchingResult.Report(searchingResult);
|
||||
|
||||
// 查询完毕
|
||||
_progUpdateQueryStatus.Report(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出
|
||||
/// </summary>
|
||||
public async void Export()
|
||||
{
|
||||
try
|
||||
{
|
||||
var dlg = new Microsoft.Win32.SaveFileDialog();
|
||||
dlg.DefaultExt = ".xlsx"; // Default file extension
|
||||
dlg.FileName = $"Operation Log_{DateTime.Now:yyyyMMdd_HHmmss}";
|
||||
dlg.Filter = "Excel数据表格文件(*.xlsx)|*.xlsx"; // Filter files by extension
|
||||
var result = dlg.ShowDialog(); // Show open file dialog box
|
||||
|
||||
if (result != true)
|
||||
return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
|
||||
_progUpdateExportingState.Report(new Tuple<int, string>(0, "Querying data ..."));
|
||||
|
||||
// 查询数据
|
||||
var queryRet = QueryEventLogs(0, false);
|
||||
if (queryRet == null || queryRet.Count <= 0)
|
||||
throw new Exception("no event logs are found, please change the conditions and retry.");
|
||||
|
||||
|
||||
var ds = new DataSet();
|
||||
ds.Tables.Add(new System.Data.DataTable("系统运行日志"));
|
||||
ds.Tables[0].Columns.Add("Type");
|
||||
ds.Tables[0].Columns.Add("Time");
|
||||
ds.Tables[0].Columns.Add("System");
|
||||
ds.Tables[0].Columns.Add("Content");
|
||||
|
||||
var currRow = 0;
|
||||
var totalRow = queryRet.Count;
|
||||
foreach (var item in queryRet)
|
||||
{
|
||||
currRow++;
|
||||
|
||||
_progUpdateExportingState.Report(new Tuple<int, string>(50,
|
||||
$"Exporting item {currRow}/{totalRow} ..."));
|
||||
|
||||
var row = ds.Tables[0].NewRow();
|
||||
row[0] = item.Level;
|
||||
row[1] = item.OccuringTime.ToString("yyyy/MM/dd HH:mm:ss.fff");
|
||||
row[2] = item.Source;
|
||||
row[3] = item.Description;
|
||||
ds.Tables[0].Rows.Add(row);
|
||||
}
|
||||
|
||||
_progUpdateExportingState.Report(new Tuple<int, string>(60, "Writing excel file ..."));
|
||||
if (!ExcelHelper.ExportToExcel(dlg.FileName, ds, out var reason))
|
||||
throw new InvalidOperationException($"Export failed, {reason}");
|
||||
|
||||
_progUpdateExportingState.Report(new Tuple<int, string>(100, "Done!"));
|
||||
});
|
||||
|
||||
MessageBox.Show($"Export succeed, file save as {dlg.FileName}", "Export", MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LOG.Write(ex);
|
||||
MessageBox.Show("导出系统日志发生错误", "导出失败", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_progUpdateExportingState.Report(new Tuple<int, string>(100, "Done!"));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace MECF.Framework.UI.Client.CenterViews.DataLogs.Event
|
||||
{
|
||||
public class SystemLogItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public string Time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ICON
|
||||
/// </summary>
|
||||
public object Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型:操作日志|事件|其他
|
||||
/// </summary>
|
||||
public string LogType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 针对腔体
|
||||
/// </summary>
|
||||
public string TargetChamber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发起方
|
||||
/// </summary>
|
||||
public string Initiator { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
public string Detail { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user