终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

322 lines
15 KiB

  1. <Window
  2. x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  10. Title="LoginView"
  11. Width="1920"
  12. Height="1080"
  13. AllowsTransparency="True"
  14. Background="{x:Null}"
  15. Topmost="False"
  16. WindowStartupLocation="CenterScreen"
  17. WindowState="Normal"
  18. WindowStyle="None"
  19. mc:Ignorable="d">
  20. <Window.DataContext>
  21. <vm:LoginViewModel />
  22. </Window.DataContext>
  23. <Window.Resources>
  24. <Style x:Key="TxLogin" TargetType="TextBlock">
  25. <Setter Property="FontSize" Value="20" />
  26. <Setter Property="Foreground" Value="#ddd" />
  27. <Setter Property="HorizontalAlignment" Value="Center" />
  28. <Setter Property="VerticalAlignment" Value="Center" />
  29. </Style>
  30. <!--#region 密码输入框样式-->
  31. <Style x:Key="PasswordBoxStyle" TargetType="{x:Type PasswordBox}">
  32. <Setter Property="Background" Value="Transparent" />
  33. <Setter Property="FontFamily" Value="Times New Roman" />
  34. <Setter Property="PasswordChar" Value="●" />
  35. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  36. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  37. <Setter Property="HorizontalContentAlignment" Value="Left" />
  38. <Setter Property="Padding" Value="1" />
  39. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  40. <Setter Property="AllowDrop" Value="true" />
  41. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  42. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  43. <Setter Property="CaretBrush" Value="#009DFF" />
  44. <Setter Property="Template">
  45. <Setter.Value>
  46. <ControlTemplate TargetType="{x:Type PasswordBox}">
  47. <Border
  48. x:Name="Bd"
  49. Background="{TemplateBinding Background}"
  50. BorderBrush="{TemplateBinding BorderBrush}"
  51. BorderThickness="{TemplateBinding BorderThickness}"
  52. CornerRadius="5"
  53. SnapsToDevicePixels="true">
  54. <Grid>
  55. <Grid.ColumnDefinitions>
  56. <ColumnDefinition Width="40" />
  57. <ColumnDefinition />
  58. </Grid.ColumnDefinitions>
  59. <TextBlock
  60. x:Name="UserTextBlock"
  61. HorizontalAlignment="Center"
  62. VerticalAlignment="Center"
  63. FontFamily="../../Fonts/#iconfont"
  64. FontSize="30"
  65. Foreground="{TemplateBinding BorderBrush}"
  66. Text="&#xe60c;" />
  67. <!--<TextBlock
  68. Name="markText"
  69. Grid.Column="1"
  70. Margin="10,0"
  71. HorizontalAlignment="Left"
  72. VerticalAlignment="Center"
  73. FontSize="20"
  74. Foreground="#88009dff"
  75. Text="请输入账号密码"
  76. Visibility="Collapsed" />-->
  77. <ScrollViewer
  78. x:Name="PART_ContentHost"
  79. Grid.Column="1"
  80. MinHeight="20"
  81. VerticalAlignment="Center"
  82. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  83. </Grid>
  84. </Border>
  85. <ControlTemplate.Triggers>
  86. <Trigger Property="IsEnabled" Value="false">
  87. <Setter TargetName="Bd" Property="Opacity" Value="0.56" />
  88. <Setter TargetName="UserTextBlock" Property="Opacity" Value="0.56" />
  89. </Trigger>
  90. <Trigger Property="IsMouseOver" Value="true">
  91. <Setter TargetName="Bd" Property="BorderBrush" Value="#FF7EB4EA" />
  92. <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF7EB4EA" />
  93. </Trigger>
  94. <Trigger Property="IsKeyboardFocused" Value="true">
  95. <Setter TargetName="Bd" Property="BorderBrush" Value="#FF569DE5" />
  96. <Setter TargetName="UserTextBlock" Property="Foreground" Value="#FF569DE5" />
  97. </Trigger>
  98. <!--<DataTrigger Binding="{Binding Path=Password, RelativeSource={RelativeSource Mode=self}}" Value="">
  99. <Setter TargetName="markText" Property="Visibility" Value="Visible" />
  100. </DataTrigger>-->
  101. </ControlTemplate.Triggers>
  102. </ControlTemplate>
  103. </Setter.Value>
  104. </Setter>
  105. <Style.Triggers>
  106. <MultiTrigger>
  107. <MultiTrigger.Conditions>
  108. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  109. <Condition Property="IsSelectionActive" Value="false" />
  110. </MultiTrigger.Conditions>
  111. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  112. </MultiTrigger>
  113. </Style.Triggers>
  114. </Style>
  115. <!--#endregion-->
  116. <!--#region 用户输入框样式-->
  117. <Style x:Key="UserTextBoxStyle" TargetType="TextBox">
  118. <Setter Property="Background" Value="Transparent" />
  119. <Setter Property="CaretBrush" Value="#009DFF" />
  120. <Setter Property="Template">
  121. <Setter.Value>
  122. <ControlTemplate TargetType="TextBox">
  123. <Border
  124. x:Name="border"
  125. Background="{TemplateBinding Background}"
  126. BorderBrush="{TemplateBinding BorderBrush}"
  127. BorderThickness="{TemplateBinding BorderThickness}"
  128. CornerRadius="5"
  129. SnapsToDevicePixels="true">
  130. <Grid>
  131. <Grid.ColumnDefinitions>
  132. <ColumnDefinition Width="40" />
  133. <ColumnDefinition />
  134. </Grid.ColumnDefinitions>
  135. <TextBlock
  136. x:Name="PasswordTextBlock"
  137. HorizontalAlignment="Center"
  138. VerticalAlignment="Center"
  139. FontFamily="../../Fonts/#iconfont"
  140. FontSize="30"
  141. Foreground="{TemplateBinding BorderBrush}"
  142. Text="&#xe66d;" />
  143. <TextBlock
  144. Name="markText"
  145. Grid.Column="1"
  146. Margin="10,0"
  147. HorizontalAlignment="Left"
  148. VerticalAlignment="Center"
  149. FontSize="{TemplateBinding FontSize}"
  150. Foreground="#88009dff"
  151. Text="请输入账号名称"
  152. Visibility="Collapsed" />
  153. <ScrollViewer
  154. x:Name="PART_ContentHost"
  155. Grid.Column="1"
  156. MinHeight="20"
  157. VerticalAlignment="Center"
  158. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  159. </Grid>
  160. </Border>
  161. <ControlTemplate.Triggers>
  162. <Trigger Property="IsEnabled" Value="false">
  163. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  164. </Trigger>
  165. <Trigger Property="IsMouseOver" Value="true">
  166. <Setter TargetName="border" Property="BorderBrush" Value="#FF7EB4EA" />
  167. </Trigger>
  168. <Trigger Property="IsKeyboardFocused" Value="true">
  169. <Setter TargetName="border" Property="BorderBrush" Value="#FF569DE5" />
  170. </Trigger>
  171. <DataTrigger Binding="{Binding Path=Text, RelativeSource={RelativeSource Mode=self}}" Value="">
  172. <Setter TargetName="markText" Property="Visibility" Value="Visible" />
  173. </DataTrigger>
  174. </ControlTemplate.Triggers>
  175. </ControlTemplate>
  176. </Setter.Value>
  177. </Setter>
  178. </Style>
  179. <!--#endregion-->
  180. <!--#region 操作按钮样式-->
  181. <Style x:Key="ButtonStyle" TargetType="Button">
  182. <Setter Property="Margin" Value="20,20" />
  183. <Setter Property="Background" Value="#cc009DFF" />
  184. <Setter Property="BorderThickness" Value="0" />
  185. <Setter Property="FontSize" Value="30" />
  186. <Setter Property="Foreground" Value="White" />
  187. <Setter Property="Template">
  188. <Setter.Value>
  189. <ControlTemplate TargetType="Button">
  190. <Border
  191. Name="TitleBarBr"
  192. Background="{TemplateBinding Background}"
  193. BorderBrush="{TemplateBinding BorderBrush}"
  194. BorderThickness="{TemplateBinding BorderThickness}"
  195. CornerRadius="20">
  196. <ContentPresenter
  197. Margin="{TemplateBinding Margin}"
  198. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  199. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  200. </Border>
  201. <ControlTemplate.Triggers>
  202. <Trigger Property="IsMouseOver" Value="true">
  203. <Setter TargetName="TitleBarBr" Property="Background" Value="#009DFF" />
  204. </Trigger>
  205. </ControlTemplate.Triggers>
  206. </ControlTemplate>
  207. </Setter.Value>
  208. </Setter>
  209. </Style>
  210. <!--#endregion-->
  211. </Window.Resources>
  212. <Grid>
  213. <MediaElement
  214. Name="player"
  215. HorizontalAlignment="Center"
  216. VerticalAlignment="Center"
  217. LoadedBehavior="Manual" />
  218. <Grid x:Name="grid" Margin="400,180">
  219. <Grid.RowDefinitions>
  220. <RowDefinition />
  221. <RowDefinition />
  222. <RowDefinition />
  223. <RowDefinition />
  224. <RowDefinition />
  225. </Grid.RowDefinitions>
  226. <TextBlock
  227. HorizontalAlignment="Center"
  228. VerticalAlignment="Center"
  229. FontSize="40"
  230. Foreground="#009DFF"
  231. Text="用户登录" />
  232. <TextBlock
  233. Grid.Row="4"
  234. HorizontalAlignment="Center"
  235. VerticalAlignment="Center"
  236. FontSize="30"
  237. Foreground="#FFEF2020"
  238. Text="{Binding ErrorInfo}" />
  239. <TextBox
  240. Name="Username"
  241. Grid.Row="1"
  242. Margin="20,20"
  243. BorderBrush="#009DFF"
  244. BorderThickness="3"
  245. FontSize="30"
  246. Foreground="#009DFF"
  247. KeyDown="TextBox_KeyDown"
  248. Style="{DynamicResource UserTextBoxStyle}"
  249. TabIndex="1"
  250. Text="{Binding UserName}" />
  251. <PasswordBox
  252. Name="pb"
  253. Grid.Row="2"
  254. Margin="20,20"
  255. common:PasswordHelper.Attach="True"
  256. common:PasswordHelper.Password="{Binding Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  257. BorderBrush="#009DFF"
  258. BorderThickness="3"
  259. FontSize="30"
  260. Foreground="#009DFF"
  261. KeyDown="pb_KeyDown"
  262. PasswordChanged="PasswordBox_PasswordChanged"
  263. Style="{DynamicResource PasswordBoxStyle}"
  264. TabIndex="2" />
  265. <TextBlock
  266. Name="markText"
  267. Grid.Row="2"
  268. Margin="70,5"
  269. HorizontalAlignment="Left"
  270. VerticalAlignment="Center"
  271. FontSize="30"
  272. Foreground="#88009dff"
  273. IsHitTestVisible="False"
  274. Text="请输入账号密码"
  275. Visibility="Visible" />
  276. <Grid Grid.Row="3">
  277. <Grid.ColumnDefinitions>
  278. <ColumnDefinition />
  279. <ColumnDefinition />
  280. </Grid.ColumnDefinitions>
  281. <Button
  282. Command="{Binding ExitCommand}"
  283. Content="退 出"
  284. Style="{StaticResource ButtonStyle}" />
  285. <Button
  286. Grid.Column="1"
  287. Command="{Binding LoginCommand}"
  288. Content="登 录"
  289. Style="{StaticResource ButtonStyle}"
  290. TabIndex="3" />
  291. </Grid>
  292. </Grid>
  293. </Grid>
  294. </Window>