123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289 |
- <UserControl
- x:Class="ShakerManger.View.LogView"
- 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:hc="https://handyorg.github.io/handycontrol"
- xmlns:local="clr-namespace:ShakerManger.View"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:model="clr-namespace:Shaker.Model;assembly=Shaker"
- xmlns:system="clr-namespace:System;assembly=mscorlib"
- xmlns:vm="clr-namespace:ShakerManger.ViewModel"
- d:DataContext="{d:DesignInstance {x:Type vm:LogMangerViewModel}}"
- d:DesignHeight="450"
- d:DesignWidth="800"
- DataContext="{Binding Source={StaticResource MainViewModel}, Path=Data.LogManger}"
- Foreground="{StaticResource LableBrush}"
- mc:Ignorable="d">
- <UserControl.Resources>
- <system:Double x:Key="fontsize">14</system:Double>
- </UserControl.Resources>
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="66" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <UniformGrid Rows="1">
- <StackPanel Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontSize="{StaticResource fontsize}"
- Text="开始时间" />
- <hc:DateTimePicker
- Width="220"
- Height="46"
- Margin="10,0,0,0"
- Background="Transparent"
- DateTimeFormat="yyyy/MM/dd HH:mm:ss"
- FontSize="{StaticResource fontsize}"
- SelectedDateTime="{Binding StartTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontSize="{StaticResource fontsize}"
- Text="截至时间" />
- <hc:DateTimePicker
- Width="220"
- Height="46"
- Margin="10,0,0,0"
- Background="Transparent"
- CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
- DateTimeFormat="yyyy/MM/dd HH:mm:ss"
- FontSize="{StaticResource fontsize}"
- SelectedDateTime="{Binding EndTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontSize="{StaticResource fontsize}"
- Text="振动台" />
- <ComboBox
- Width="220"
- Height="46"
- Margin="10,0,0,0"
- Background="Transparent"
- DisplayMemberPath="Key"
- FontSize="{StaticResource fontsize}"
- ItemsSource="{Binding Shakers}"
- SelectedValue="{Binding SelectedShaker}"
- SelectedValuePath="Value"
- Style="{StaticResource ComboBoxStyle1}" />
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontSize="{StaticResource fontsize}"
- Text="日志类型" />
- <ComboBox
- Width="220"
- Height="46"
- Margin="10,0,0,0"
- Background="Transparent"
- DisplayMemberPath="Description"
- FontSize="{StaticResource fontsize}"
- ItemsSource="{Binding LogType, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
- SelectedValue="{Binding LogType}"
- SelectedValuePath="Value"
- Style="{StaticResource ComboBoxStyle1}" />
- </StackPanel>
- <StackPanel Orientation="Horizontal">
- <TextBlock
- VerticalAlignment="Center"
- FontSize="{StaticResource fontsize}"
- Text="关键字" />
- <hc:TextBox
- Width="220"
- Height="46"
- Margin="10,0,0,0"
- hc:InfoElement.Placeholder="输入关键字"
- Background="Transparent"
- CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
- FontSize="{StaticResource fontsize}"
- Text="{Binding Keyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
- <Button
- Margin="20,0,0,0"
- hc:IconElement.Geometry="{StaticResource SearchGeometry}"
- Command="{Binding SearchCommand}"
- IsEnabled="{Binding Source={x:Static vm:LoginViewModel.Default}, Path=IsAnonymous, Converter={StaticResource Boolean2BooleanReConverter}}"
- Style="{StaticResource ImageButton}" />
- </StackPanel>
- </UniformGrid>
- <Border
- Grid.Row="1"
- Margin="10"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="1">
- <ListView
- FontSize="14"
- Foreground="{StaticResource LableBrush}"
- ItemsSource="{Binding Logs}">
- <ListView.Style>
- <Style TargetType="ListView">
- <Setter Property="Background" Value="White" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="Padding" Value="0" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ListView}">
- <Grid Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Path=ActualHeight}">
- <Grid.RowDefinitions>
- <RowDefinition Height="36" />
- <RowDefinition Height="*" />
- <RowDefinition Height="24" />
- </Grid.RowDefinitions>
- <Grid Background="{StaticResource EmbellishBrush}">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="220" />
- <ColumnDefinition Width="100" />
- <ColumnDefinition Width="140" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Border BorderBrush="{StaticResource AuxiliaryBrush}" BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="{StaticResource MainBrush}"
- Text="记录时间" />
- </Border>
- <Border
- Grid.Column="2"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="{StaticResource MainBrush}"
- Text="振动台" />
- </Border>
- <Border
- Grid.Column="1"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- Foreground="{StaticResource MainBrush}"
- VerticalAlignment="Center"
- Text="用户" />
- </Border>
- <Border
- Grid.Column="3"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,0,1">
- <TextBlock
- Foreground="{StaticResource MainBrush}"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="日志" />
- </Border>
- </Grid>
- <ScrollViewer
- Grid.Row="1"
- HorizontalScrollBarVisibility="Hidden"
- VerticalScrollBarVisibility="Auto">
- <ItemsPresenter Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </ScrollViewer>
- <Border Grid.Row="2" Background="{StaticResource AuxiliaryBrush}">
- <TextBlock
- Grid.Row="2"
- Foreground="{StaticResource LableBrush}"
- Margin="10,0,0,0"
- VerticalAlignment="Center"
- Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Path=DataContext.Logs.Count, StringFormat=记录条数:{0}}" />
- </Border>
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="220" />
- <ColumnDefinition Width="100" />
- <ColumnDefinition Width="140" />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <Border
- Grid.Column="0"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{Binding DateTime, StringFormat=yyyy/MM/dd HH:mm:ss.fff}" />
- </Border>
- <Border
- Grid.Column="1"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{Binding UserID}" />
- </Border>
- <Border
- Grid.Column="2"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,1,1">
- <TextBlock
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Text="{Binding ShakerID}" />
- </Border>
- <Border
- Grid.Column="3"
- BorderBrush="{StaticResource AuxiliaryBrush}"
- BorderThickness="0,0,0,1">
- <TextBlock
- x:Name="text"
- Margin="20,0,0,0"
- VerticalAlignment="Center"
- Text="{Binding Message}" />
- </Border>
- </Grid>
- <DataTemplate.Triggers>
- <DataTrigger Binding="{Binding Level}" Value="{x:Static model:LogType.Message}">
- <Setter TargetName="text" Property="Foreground" Value="{StaticResource LableBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Level}" Value="{x:Static model:LogType.Warn}">
- <Setter TargetName="text" Property="Foreground" Value="{StaticResource LableBrush}" />
- </DataTrigger>
- <DataTrigger Binding="{Binding Level}" Value="{x:Static model:LogType.Error}">
- <Setter TargetName="text" Property="Foreground" Value="Red" />
- </DataTrigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="ItemContainerStyle">
- <Setter.Value>
- <Style TargetType="ListViewItem">
- <Setter Property="MinHeight" Value="32" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="BorderBrush" Value="Transparent" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="OverridesDefaultStyle" Value="True" />
- <Setter Property="Cursor" Value="Hand" />
- <Setter Property="IsEnabled" Value="False" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ListViewItem">
- <ContentPresenter />
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </Setter.Value>
- </Setter>
- </Style>
- </ListView.Style>
- </ListView>
- </Border>
- </Grid>
- </UserControl>
|