WarnLogView.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <UserControl
  2. x:Class="ShakerManger.View.WarnLogView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:hc="https://handyorg.github.io/handycontrol"
  7. xmlns:local="clr-namespace:ShakerManger.View"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:model="clr-namespace:Shaker.Model;assembly=Shaker"
  10. xmlns:system="clr-namespace:System;assembly=mscorlib"
  11. xmlns:vm="clr-namespace:ShakerManger.ViewModel"
  12. d:DataContext="{d:DesignInstance {x:Type vm:WarnMangerViewModel}}"
  13. d:DesignHeight="450"
  14. d:DesignWidth="800"
  15. DataContext="{Binding Source={StaticResource MainViewModel}, Path=Data.WarnManger}"
  16. mc:Ignorable="d">
  17. <UserControl.Resources>
  18. <system:Double x:Key="fontsize">14</system:Double>
  19. </UserControl.Resources>
  20. <Grid>
  21. <Grid.RowDefinitions>
  22. <RowDefinition Height="66" />
  23. <RowDefinition Height="*" />
  24. </Grid.RowDefinitions>
  25. <UniformGrid Rows="1">
  26. <StackPanel Orientation="Horizontal">
  27. <TextBlock
  28. VerticalAlignment="Center"
  29. FontSize="{StaticResource fontsize}"
  30. Foreground="{StaticResource LableBrush}"
  31. Text="开始时间" />
  32. <hc:DateTimePicker
  33. Width="220"
  34. Height="46"
  35. Margin="10,0,0,0"
  36. Background="Transparent"
  37. DateTimeFormat="yyyy/MM/dd HH:mm:ss"
  38. FontSize="{StaticResource fontsize}"
  39. Foreground="{StaticResource LableBrush}"
  40. SelectedDateTime="{Binding StartTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  41. </StackPanel>
  42. <StackPanel Orientation="Horizontal">
  43. <TextBlock
  44. VerticalAlignment="Center"
  45. FontSize="{StaticResource fontsize}"
  46. Foreground="{StaticResource LableBrush}"
  47. Text="截至时间" />
  48. <hc:DateTimePicker
  49. Width="220"
  50. Height="46"
  51. Margin="10,0,0,0"
  52. Background="Transparent"
  53. CaretBrush="{StaticResource LableBrush}"
  54. DateTimeFormat="yyyy/MM/dd HH:mm:ss"
  55. FontSize="{StaticResource fontsize}"
  56. Foreground="{StaticResource LableBrush}"
  57. SelectedDateTime="{Binding EndTime, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  58. </StackPanel>
  59. <StackPanel Orientation="Horizontal">
  60. <TextBlock
  61. VerticalAlignment="Center"
  62. FontSize="{StaticResource fontsize}"
  63. Foreground="{StaticResource LableBrush}"
  64. Text="振动台" />
  65. <ComboBox
  66. Width="220"
  67. Height="46"
  68. Margin="10,0,0,0"
  69. Background="Transparent"
  70. DisplayMemberPath="Key"
  71. FontSize="{StaticResource fontsize}"
  72. Foreground="{StaticResource LableBrush}"
  73. ItemsSource="{Binding Shakers}"
  74. SelectedValue="{Binding SelectedShaker}"
  75. SelectedValuePath="Value"
  76. Style="{StaticResource ComboBoxStyle1}" />
  77. </StackPanel>
  78. <StackPanel Orientation="Horizontal">
  79. <TextBlock
  80. VerticalAlignment="Center"
  81. FontSize="{StaticResource fontsize}"
  82. Foreground="{StaticResource LableBrush}"
  83. Text="日志类型" />
  84. <ComboBox
  85. Width="220"
  86. Height="46"
  87. Margin="10,0,0,0"
  88. Background="Transparent"
  89. DisplayMemberPath="Description"
  90. FontSize="{StaticResource fontsize}"
  91. Foreground="{StaticResource LableBrush}"
  92. ItemsSource="{Binding LogType, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
  93. SelectedValue="{Binding LogType}"
  94. SelectedValuePath="Value"
  95. Style="{StaticResource ComboBoxStyle1}" />
  96. </StackPanel>
  97. <StackPanel Orientation="Horizontal">
  98. <TextBlock
  99. VerticalAlignment="Center"
  100. FontSize="{StaticResource fontsize}"
  101. Foreground="{StaticResource LableBrush}"
  102. Text="关键字" />
  103. <hc:TextBox
  104. Width="220"
  105. Height="46"
  106. Margin="10,0,0,0"
  107. hc:InfoElement.Placeholder="输入关键字"
  108. Background="Transparent"
  109. CaretBrush="{StaticResource LableBrush}"
  110. FontSize="{StaticResource fontsize}"
  111. Foreground="{StaticResource LableBrush}"
  112. Text="{Binding Keyword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  113. <Button
  114. Margin="20,0,0,0"
  115. hc:IconElement.Geometry="{StaticResource SearchGeometry}"
  116. Command="{Binding SearchCommand}"
  117. IsEnabled="{Binding Source={x:Static vm:LoginViewModel.Default}, Path=IsAnonymous, Converter={StaticResource Boolean2BooleanReConverter}}"
  118. Style="{StaticResource ImageButton}" />
  119. </StackPanel>
  120. </UniformGrid>
  121. <Border
  122. Grid.Row="1"
  123. Margin="10"
  124. BorderBrush="{StaticResource AuxiliaryBrush}"
  125. BorderThickness="1">
  126. <ListView
  127. FontSize="14"
  128. Foreground="{StaticResource MainBrush}"
  129. ItemsSource="{Binding Logs}">
  130. <ListView.Style>
  131. <Style TargetType="ListView">
  132. <Setter Property="Background" Value="White" />
  133. <Setter Property="BorderBrush" Value="Transparent" />
  134. <Setter Property="Padding" Value="0" />
  135. <Setter Property="Template">
  136. <Setter.Value>
  137. <ControlTemplate TargetType="{x:Type ListView}">
  138. <Grid Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Path=ActualHeight}">
  139. <Grid.RowDefinitions>
  140. <RowDefinition Height="36" />
  141. <RowDefinition Height="*" />
  142. <RowDefinition Height="24" />
  143. </Grid.RowDefinitions>
  144. <Grid Background="{StaticResource EmbellishBrush}">
  145. <Grid.ColumnDefinitions>
  146. <ColumnDefinition Width="220" />
  147. <ColumnDefinition Width="100" />
  148. <ColumnDefinition Width="140" />
  149. <ColumnDefinition />
  150. </Grid.ColumnDefinitions>
  151. <Border BorderBrush="{StaticResource AuxiliaryBrush}" BorderThickness="0,0,1,1">
  152. <TextBlock
  153. HorizontalAlignment="Center"
  154. VerticalAlignment="Center"
  155. Text="记录时间" />
  156. </Border>
  157. <Border
  158. Grid.Column="2"
  159. BorderBrush="{StaticResource AuxiliaryBrush}"
  160. BorderThickness="0,0,1,1">
  161. <TextBlock
  162. HorizontalAlignment="Center"
  163. VerticalAlignment="Center"
  164. Text="振动台" />
  165. </Border>
  166. <Border
  167. Grid.Column="1"
  168. BorderBrush="{StaticResource AuxiliaryBrush}"
  169. BorderThickness="0,0,1,1">
  170. <TextBlock
  171. HorizontalAlignment="Center"
  172. VerticalAlignment="Center"
  173. Text="用户" />
  174. </Border>
  175. <Border
  176. Grid.Column="3"
  177. BorderBrush="{StaticResource AuxiliaryBrush}"
  178. BorderThickness="0,0,0,1">
  179. <TextBlock
  180. HorizontalAlignment="Center"
  181. VerticalAlignment="Center"
  182. Text="日志" />
  183. </Border>
  184. </Grid>
  185. <ScrollViewer
  186. Grid.Row="1"
  187. HorizontalScrollBarVisibility="Hidden"
  188. VerticalScrollBarVisibility="Auto">
  189. <ItemsPresenter Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  190. </ScrollViewer>
  191. <Border Grid.Row="2" Background="{StaticResource AuxiliaryBrush}">
  192. <TextBlock
  193. Grid.Row="2"
  194. Margin="10,0,0,0"
  195. VerticalAlignment="Center"
  196. Foreground="{StaticResource LableBrush}"
  197. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListView}, Path=DataContext.Logs.Count, StringFormat=记录条数:{0}}" />
  198. </Border>
  199. </Grid>
  200. </ControlTemplate>
  201. </Setter.Value>
  202. </Setter>
  203. <Setter Property="ItemTemplate">
  204. <Setter.Value>
  205. <DataTemplate>
  206. <Grid>
  207. <Grid.ColumnDefinitions>
  208. <ColumnDefinition Width="220" />
  209. <ColumnDefinition Width="100" />
  210. <ColumnDefinition Width="140" />
  211. <ColumnDefinition />
  212. </Grid.ColumnDefinitions>
  213. <Border
  214. Grid.Column="0"
  215. BorderBrush="{StaticResource AuxiliaryBrush}"
  216. BorderThickness="0,0,1,1">
  217. <TextBlock
  218. HorizontalAlignment="Center"
  219. VerticalAlignment="Center"
  220. Foreground="{StaticResource LableBrush}"
  221. Text="{Binding DateTime, StringFormat=yyyy/MM/dd HH:mm:ss.fff}" />
  222. </Border>
  223. <Border
  224. Grid.Column="1"
  225. BorderBrush="{StaticResource AuxiliaryBrush}"
  226. BorderThickness="0,0,1,1">
  227. <TextBlock
  228. HorizontalAlignment="Center"
  229. VerticalAlignment="Center"
  230. Foreground="{StaticResource LableBrush}"
  231. Text="{Binding UserID}" />
  232. </Border>
  233. <Border
  234. Grid.Column="2"
  235. BorderBrush="{StaticResource AuxiliaryBrush}"
  236. BorderThickness="0,0,1,1">
  237. <TextBlock
  238. HorizontalAlignment="Center"
  239. VerticalAlignment="Center"
  240. Foreground="{StaticResource LableBrush}"
  241. Text="{Binding ShakerID}" />
  242. </Border>
  243. <Border
  244. Grid.Column="3"
  245. BorderBrush="{StaticResource AuxiliaryBrush}"
  246. BorderThickness="0,0,0,1">
  247. <TextBlock
  248. x:Name="text"
  249. Margin="20,0,0,0"
  250. VerticalAlignment="Center"
  251. Foreground="{StaticResource LableBrush}"
  252. Text="{Binding Message}" />
  253. </Border>
  254. </Grid>
  255. <DataTemplate.Triggers>
  256. <DataTrigger Binding="{Binding WarnType}" Value="{x:Static model:WarnType.Error}">
  257. <Setter TargetName="text" Property="Foreground" Value="{DynamicResource ErrorBrush}" />
  258. </DataTrigger>
  259. </DataTemplate.Triggers>
  260. </DataTemplate>
  261. </Setter.Value>
  262. </Setter>
  263. <Setter Property="ItemContainerStyle">
  264. <Setter.Value>
  265. <Style TargetType="ListViewItem">
  266. <Setter Property="MinHeight" Value="32" />
  267. <Setter Property="Background" Value="Transparent" />
  268. <Setter Property="BorderBrush" Value="Transparent" />
  269. <Setter Property="BorderThickness" Value="0" />
  270. <Setter Property="SnapsToDevicePixels" Value="True" />
  271. <Setter Property="OverridesDefaultStyle" Value="True" />
  272. <Setter Property="Cursor" Value="Hand" />
  273. <Setter Property="IsEnabled" Value="False" />
  274. <Setter Property="Template">
  275. <Setter.Value>
  276. <ControlTemplate TargetType="ListViewItem">
  277. <ContentPresenter />
  278. </ControlTemplate>
  279. </Setter.Value>
  280. </Setter>
  281. </Style>
  282. </Setter.Value>
  283. </Setter>
  284. </Style>
  285. </ListView.Style>
  286. </ListView>
  287. </Border>
  288. </Grid>
  289. </UserControl>