MainWindow.xaml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <Window
  2. x:Class="ShakerManger.MainWindow"
  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:data="clr-namespace:ShakerManger.Data"
  7. xmlns:hc="https://handyorg.github.io/handycontrol"
  8. xmlns:local="clr-namespace:ShakerManger"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:system="clr-namespace:System;assembly=mscorlib"
  11. xmlns:view="clr-namespace:ShakerManger.View"
  12. xmlns:vm="clr-namespace:ShakerManger.ViewModel"
  13. Title="MainWindow"
  14. Width="{x:Static SystemParameters.PrimaryScreenWidth}"
  15. Height="{x:Static SystemParameters.PrimaryScreenHeight}"
  16. d:DataContext="{d:DesignInstance {x:Type vm:MainWindowViewModel}}"
  17. Background="{StaticResource SystemItemsSelectBackColor}"
  18. BorderThickness="0"
  19. DataContext="{Binding Source={StaticResource MainViewModel}, Path=Data}"
  20. Left="0"
  21. ResizeMode="NoResize"
  22. Top="0"
  23. Topmost="True"
  24. WindowStartupLocation="Manual"
  25. WindowState="Normal"
  26. WindowStyle="None"
  27. mc:Ignorable="d">
  28. <hc:Interaction.Triggers>
  29. <hc:EventTrigger EventName="Closing">
  30. <hc:InvokeCommandAction Command="{Binding CloseCommand}" />
  31. </hc:EventTrigger>
  32. </hc:Interaction.Triggers>
  33. <WindowChrome.WindowChrome>
  34. <WindowChrome
  35. CaptionHeight="0"
  36. CornerRadius="0"
  37. GlassFrameThickness="0"
  38. ResizeBorderThickness="0" />
  39. </WindowChrome.WindowChrome>
  40. <Viewbox Stretch="Fill">
  41. <Grid Width="1920" Height="1080">
  42. <Grid.Style>
  43. <Style TargetType="Grid">
  44. <Style.Triggers>
  45. <MultiDataTrigger>
  46. <MultiDataTrigger.Conditions>
  47. <Condition Binding="{Binding Prompt.IsOpen}" Value="True" />
  48. <Condition Binding="{Binding Login.IsLoggedIn, Converter={StaticResource Boolean2BooleanReConverter}}" Value="True" />
  49. </MultiDataTrigger.Conditions>
  50. <Setter Property="IsEnabled" Value="False" />
  51. </MultiDataTrigger>
  52. <MultiDataTrigger>
  53. <MultiDataTrigger.Conditions>
  54. <Condition Binding="{Binding Prompt.IsOpen}" Value="False" />
  55. <Condition Binding="{Binding Login.IsLoggedIn, Converter={StaticResource Boolean2BooleanReConverter}}" Value="True" />
  56. </MultiDataTrigger.Conditions>
  57. <Setter Property="IsEnabled" Value="False" />
  58. </MultiDataTrigger>
  59. <MultiDataTrigger>
  60. <MultiDataTrigger.Conditions>
  61. <Condition Binding="{Binding Prompt.IsOpen}" Value="True" />
  62. <Condition Binding="{Binding Login.IsLoggedIn, Converter={StaticResource Boolean2BooleanReConverter}}" Value="False" />
  63. </MultiDataTrigger.Conditions>
  64. <Setter Property="IsEnabled" Value="False" />
  65. </MultiDataTrigger>
  66. <MultiDataTrigger>
  67. <MultiDataTrigger.Conditions>
  68. <Condition Binding="{Binding Prompt.IsOpen}" Value="False" />
  69. <Condition Binding="{Binding Login.IsLoggedIn, Converter={StaticResource Boolean2BooleanReConverter}}" Value="False" />
  70. </MultiDataTrigger.Conditions>
  71. <Setter Property="IsEnabled" Value="True" />
  72. </MultiDataTrigger>
  73. </Style.Triggers>
  74. </Style>
  75. </Grid.Style>
  76. <Grid.RowDefinitions>
  77. <RowDefinition Height="66" />
  78. <RowDefinition Height="*" />
  79. </Grid.RowDefinitions>
  80. <Border Grid.ColumnSpan="2" Background="{StaticResource TitleBackColor}">
  81. <Grid>
  82. <Grid.ColumnDefinitions>
  83. <ColumnDefinition Width="400" />
  84. <ColumnDefinition Width="*" />
  85. <ColumnDefinition Width="200" />
  86. <ColumnDefinition Width="auto" />
  87. </Grid.ColumnDefinitions>
  88. <TextBlock
  89. Margin="20,0,10,0"
  90. VerticalAlignment="Center"
  91. FontSize="36"
  92. FontWeight="Bold"
  93. Text="{StaticResource Title}" />
  94. <ListView
  95. Grid.Column="1"
  96. Margin="20,0,20,0"
  97. IsEnabled="{Binding IsEnabled}"
  98. ItemsSource="{Binding MainPages}"
  99. SelectedValue="{Binding CurrentMainPage}">
  100. <ListView.Style>
  101. <Style TargetType="ListView" BasedOn="{x:Null}">
  102. <Setter Property="Background" Value="Transparent" />
  103. <Setter Property="BorderBrush" Value="Transparent" />
  104. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  105. <Setter Property="Padding" Value="0" />
  106. <Setter Property="Template">
  107. <Setter.Value>
  108. <ControlTemplate TargetType="ListView">
  109. <ItemsPresenter Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  110. </ControlTemplate>
  111. </Setter.Value>
  112. </Setter>
  113. <Setter Property="ItemTemplate">
  114. <Setter.Value>
  115. <DataTemplate>
  116. <StackPanel
  117. Margin="0"
  118. HorizontalAlignment="Center"
  119. VerticalAlignment="Center"
  120. Background="Transparent"
  121. IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=DataContext.Login.Anonymous, Converter={StaticResource Boolean2BooleanReConverter}}"
  122. Orientation="Horizontal">
  123. <Viewbox
  124. Width="32"
  125. Height="32"
  126. HorizontalAlignment="Right"
  127. VerticalAlignment="Center">
  128. <Path Data="{Binding IconPath}" Fill="{StaticResource SystemItemsForeColor}" />
  129. </Viewbox>
  130. <TextBlock
  131. Grid.Column="1"
  132. Margin="20,0,0,0"
  133. HorizontalAlignment="Left"
  134. VerticalAlignment="Center"
  135. FontSize="22"
  136. Foreground="{StaticResource SystemItemsForeColor}"
  137. Text="{Binding MainPageType, Converter={StaticResource EnumToDescription}}" />
  138. </StackPanel>
  139. </DataTemplate>
  140. </Setter.Value>
  141. </Setter>
  142. <Setter Property="ItemContainerStyle">
  143. <Setter.Value>
  144. <Style TargetType="ListViewItem">
  145. <Setter Property="Background" Value="Transparent" />
  146. <Setter Property="BorderBrush" Value="Transparent" />
  147. <Setter Property="BorderThickness" Value="0" />
  148. <Setter Property="SnapsToDevicePixels" Value="True" />
  149. <Setter Property="OverridesDefaultStyle" Value="True" />
  150. <Setter Property="Cursor" Value="Hand" />
  151. <Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
  152. <Setter Property="Padding" Value="0" />
  153. <Setter Property="Template">
  154. <Setter.Value>
  155. <ControlTemplate TargetType="ListViewItem">
  156. <Border
  157. x:Name="backcolor"
  158. Margin="0"
  159. Padding="0"
  160. CornerRadius="12,12,0,0">
  161. <ContentPresenter
  162. Margin="0"
  163. Content="{TemplateBinding Content}"
  164. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  165. ContentTemplate="{TemplateBinding ContentTemplate}"
  166. ContentTemplateSelector="{x:Null}"
  167. IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}, Path=DataContext.Login.Anonymous, Converter={StaticResource Boolean2BooleanReConverter}}" />
  168. </Border>
  169. <ControlTemplate.Triggers>
  170. <Trigger Property="IsSelected" Value="True">
  171. <Setter TargetName="backcolor" Property="Background" Value="{StaticResource SystemItemsSelectBackColor}" />
  172. </Trigger>
  173. </ControlTemplate.Triggers>
  174. </ControlTemplate>
  175. </Setter.Value>
  176. </Setter>
  177. </Style>
  178. </Setter.Value>
  179. </Setter>
  180. <Setter Property="ItemsPanel">
  181. <Setter.Value>
  182. <ItemsPanelTemplate>
  183. <UniformGrid
  184. Margin="0"
  185. Rows="1"
  186. Style="{x:Null}" />
  187. </ItemsPanelTemplate>
  188. </Setter.Value>
  189. </Setter>
  190. </Style>
  191. </ListView.Style>
  192. </ListView>
  193. <UniformGrid Grid.Column="2" Rows="1">
  194. <Button
  195. Width="42"
  196. Height="42"
  197. Padding="0"
  198. hc:IconElement.Geometry="{StaticResource StartGeometry}"
  199. Command="{Binding StartAllCommand}"
  200. IsEnabled="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous, Converter={StaticResource Boolean2BooleanReConverter}}"
  201. Style="{StaticResource ImageButton}"
  202. ToolTip="全部开始" />
  203. <Button
  204. Width="42"
  205. Height="42"
  206. Padding="0"
  207. hc:IconElement.Geometry="{StaticResource StopGeometry}"
  208. Command="{Binding StopAllCommand}"
  209. IsEnabled="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous, Converter={StaticResource Boolean2BooleanReConverter}}"
  210. Style="{StaticResource ImageButton}"
  211. ToolTip="全部停止" />
  212. </UniformGrid>
  213. <StackPanel
  214. Grid.Column="3"
  215. Margin="40,0,10,0"
  216. VerticalAlignment="Center"
  217. Orientation="Horizontal">
  218. <Grid>
  219. <Button
  220. Width="42"
  221. Height="42"
  222. hc:IconElement.Geometry="m63.94311,0l668.44444,0c32.99556,0 60.13156,24.91733 63.71556,56.94578l0.34133,6.99733l0,668.55822c0,32.99556 -24.91733,60.07467 -56.94578,63.54489l-6.99733,0.39822l-668.55822,0c-32.99556,0 -60.07467,-24.91733 -63.54489,-56.94578l-0.39822,-6.99733l0,-668.55822c0,-32.99556 24.91733,-60.07467 56.94578,-63.54489l6.99733,-0.39822l668.44444,0l-668.44444,0zm107.06489,56.88889l-114.11911,0l0,682.66666l682.66666,0l0,-682.66666l-114.11911,0l0.22756,3.47022l0.11378,3.584l0,213.44711c0,32.99556 -21.33334,60.07467 -48.81067,63.54489l-5.97333,0.39822l-345.54312,0c-28.27377,0 -51.48444,-24.91733 -54.44266,-56.94578l-0.34134,-6.99733l0,-213.44711c0,-2.38933 0.11378,-4.72178 0.34134,-7.05422zm397.88089,0l-341.33334,0l0,227.55555l341.33334,0l0,-227.55555zm-85.33334,56.88889a28.44444,28.44444 0 0 1 28.44445,28.44444l0,56.88889a28.44444,28.44444 0 1 1 -56.88889,0l0,-56.88889a28.44444,28.44444 0 0 1 28.44444,-28.44444z"
  223. Command="{Binding SaveDataCommand}"
  224. Cursor="Hand">
  225. <Button.Style>
  226. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  227. <Style.Triggers>
  228. <MultiDataTrigger>
  229. <MultiDataTrigger.Conditions>
  230. <Condition Binding="{Binding IsEnabled}" Value="True" />
  231. <Condition Binding="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous}" Value="False" />
  232. </MultiDataTrigger.Conditions>
  233. <Setter Property="IsEnabled" Value="True" />
  234. </MultiDataTrigger>
  235. <MultiDataTrigger>
  236. <MultiDataTrigger.Conditions>
  237. <Condition Binding="{Binding IsEnabled}" Value="False" />
  238. <Condition Binding="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous}" Value="False" />
  239. </MultiDataTrigger.Conditions>
  240. <Setter Property="IsEnabled" Value="False" />
  241. </MultiDataTrigger>
  242. <MultiDataTrigger>
  243. <MultiDataTrigger.Conditions>
  244. <Condition Binding="{Binding IsEnabled}" Value="False" />
  245. <Condition Binding="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous}" Value="True" />
  246. </MultiDataTrigger.Conditions>
  247. <Setter Property="IsEnabled" Value="False" />
  248. </MultiDataTrigger>
  249. <MultiDataTrigger>
  250. <MultiDataTrigger.Conditions>
  251. <Condition Binding="{Binding IsEnabled}" Value="True" />
  252. <Condition Binding="{Binding Source={StaticResource Login}, Path=Data.IsAnonymous}" Value="True" />
  253. </MultiDataTrigger.Conditions>
  254. <Setter Property="IsEnabled" Value="False" />
  255. </MultiDataTrigger>
  256. </Style.Triggers>
  257. </Style>
  258. </Button.Style>
  259. </Button>
  260. <Viewbox
  261. Width="20"
  262. Height="20"
  263. Margin="0,10,0,0"
  264. IsHitTestVisible="False"
  265. Visibility="{Binding IsSaveData, Converter={StaticResource Boolean2VisibilityConverter}}">
  266. <Path
  267. Data="m0,508.958c0,-37.982 30.385,-68.367 68.367,-68.367c45.578,0 75.964,30.385 75.964,68.367c0,45.578 -30.385,75.964 -75.964,75.964c-37.982,0 -68.367,-30.385 -68.367,-75.964zm91.157,-265.873l0,0c0,-53.175 37.982,-98.753 91.157,-98.753s98.753,45.578 98.753,98.753l0,0c0,53.175 -45.578,91.157 -98.753,91.157s-91.157,-37.982 -91.157,-91.157l0,0zm37.982,539.344l0,0c0,-30.385 22.789,-53.175 53.175,-53.175s53.175,22.789 53.175,53.175l0,0c0,30.385 -22.789,53.175 -53.175,53.175s-53.175,-22.789 -53.175,-53.175zm265.874,113.946l0,0c0,-37.982 22.789,-60.772 60.772,-60.772s60.772,22.789 60.772,60.772l0,0c0,37.982 -22.789,60.772 -60.772,60.772c-37.982,0 -60.772,-22.789 -60.772,-60.772zm296.26,-113.946c0,-22.789 15.193,-37.982 37.982,-37.982s37.982,15.193 37.982,37.982c0,22.789 -15.193,37.982 -37.982,37.982c-22.789,0 -37.982,-15.193 -37.982,-37.982zm83.56,-273.471c0,-30.385 30.385,-60.772 68.367,-60.772c30.385,0 60.772,30.385 60.772,60.772c0,37.982 -30.385,68.367 -60.772,68.367c-37.982,0 -68.367,-30.385 -68.367,-68.367zm-174.717,-265.873c0,-75.964 60.772,-129.139 129.139,-129.139s129.139,53.175 129.139,129.139c0,68.367 -60.772,129.139 -129.139,129.139c-68.367,0 -129.139,-60.772 -129.139,-129.139zm-273.47,-113.946c0,-68.367 60.772,-129.139 129.139,-129.139s129.139,60.772 129.139,129.139c0,68.367 -60.772,129.139 -129.139,129.139c-68.367,0 -129.139,-60.772 -129.139,-129.139z"
  268. Fill="Green"
  269. RenderTransformOrigin="0.5,0.5">
  270. <Path.RenderTransform>
  271. <TransformGroup>
  272. <ScaleTransform />
  273. <SkewTransform />
  274. <RotateTransform Angle="0" />
  275. <TranslateTransform />
  276. </TransformGroup>
  277. </Path.RenderTransform>
  278. <Path.Triggers>
  279. <EventTrigger RoutedEvent="Loaded">
  280. <BeginStoryboard>
  281. <Storyboard>
  282. <DoubleAnimation
  283. AutoReverse="False"
  284. RepeatBehavior="Forever"
  285. SpeedRatio="1"
  286. Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)"
  287. From="0"
  288. To="360"
  289. Duration="0:0:1" />
  290. </Storyboard>
  291. </BeginStoryboard>
  292. </EventTrigger>
  293. </Path.Triggers>
  294. </Path>
  295. </Viewbox>
  296. </Grid>
  297. <Button
  298. Width="42"
  299. Height="42"
  300. Margin="20,0,0,0"
  301. VerticalAlignment="Center"
  302. hc:IconElement.Geometry="{StaticResource LayoutGeometry}"
  303. Background="{StaticResource TitleBackColor}"
  304. Cursor="Hand"
  305. IsEnabled="{Binding LayoutVisibily}">
  306. <Button.Style>
  307. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  308. <Style.Triggers>
  309. <DataTrigger Binding="{Binding CurrentMainPage.MainPageType}" Value="{x:Static data:MainPageType.ShakerManger}">
  310. <Setter Property="Visibility" Value="Visible" />
  311. </DataTrigger>
  312. <DataTrigger Binding="{Binding CurrentMainPage.MainPageType}" Value="{x:Static data:MainPageType.ConfigManger}">
  313. <Setter Property="Visibility" Value="Collapsed" />
  314. </DataTrigger>
  315. <DataTrigger Binding="{Binding CurrentMainPage.MainPageType}" Value="{x:Static data:MainPageType.DataManger}">
  316. <Setter Property="Visibility" Value="Collapsed" />
  317. </DataTrigger>
  318. <DataTrigger Binding="{Binding CurrentMainPage.MainPageType}" Value="{x:Static data:MainPageType.LogManger}">
  319. <Setter Property="Visibility" Value="Collapsed" />
  320. </DataTrigger>
  321. <DataTrigger Binding="{Binding CurrentMainPage.MainPageType}" Value="{x:Static data:MainPageType.WarnManger}">
  322. <Setter Property="Visibility" Value="Collapsed" />
  323. </DataTrigger>
  324. </Style.Triggers>
  325. </Style>
  326. </Button.Style>
  327. <hc:Interaction.Triggers>
  328. <hc:EventTrigger EventName="Click">
  329. <hc:SetPropertyAction
  330. PropertyName="IsOpen"
  331. PropertyValue="{x:Static system:Boolean.TrueString}"
  332. TargetObject="{Binding LayoutManger}" />
  333. </hc:EventTrigger>
  334. </hc:Interaction.Triggers>
  335. </Button>
  336. <Button
  337. Width="42"
  338. Height="42"
  339. Margin="20,0,0,0"
  340. VerticalAlignment="Center"
  341. hc:IconElement.Geometry="{StaticResource CloseGeometry}"
  342. Background="{StaticResource TitleBackColor}"
  343. Command="{Binding ExitCommand}"
  344. Cursor="Hand"
  345. Style="{StaticResource ImageButton}"
  346. ToolTip="关闭" />
  347. <Popup
  348. AllowsTransparency="True"
  349. IsOpen="{Binding LayoutManger.IsOpen}"
  350. Placement="Mouse"
  351. PopupAnimation="Slide"
  352. StaysOpen="False">
  353. <ContentControl Content="{Binding LayoutManger.View, Converter={StaticResource Type2ViewConverter}}" />
  354. </Popup>
  355. </StackPanel>
  356. </Grid>
  357. </Border>
  358. <ContentControl
  359. Grid.Row="1"
  360. Grid.ColumnSpan="2"
  361. Content="{Binding CurrentMainPage.View, Converter={StaticResource Type2ViewConverter}}"
  362. IsEnabled="{Binding IsEnabled}" />
  363. <Popup
  364. Grid.Row="0"
  365. Grid.RowSpan="2"
  366. Grid.ColumnSpan="2"
  367. AllowsTransparency="True"
  368. IsOpen="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers.SelectedIsOpen}"
  369. Placement="Mouse"
  370. PopupAnimation="Slide"
  371. StaysOpen="False">
  372. <view:ShakerSelectView DataContext="{Binding Source={StaticResource MainViewModel}, Path=Data.Shakers}" />
  373. </Popup>
  374. <Popup
  375. Grid.Row="0"
  376. Grid.RowSpan="2"
  377. Grid.ColumnSpan="2"
  378. AllowsTransparency="True"
  379. IsOpen="{Binding Source={StaticResource ColorPicker}, Path=IsOpen}"
  380. Placement="Mouse"
  381. PopupAnimation="Slide"
  382. StaysOpen="True">
  383. <view:ColorPickerView DataContext="{Binding Source={StaticResource ColorPicker}}" />
  384. </Popup>
  385. <hc:Drawer
  386. Grid.Row="0"
  387. Grid.RowSpan="2"
  388. Grid.ColumnSpan="2"
  389. Dock="Top"
  390. IsOpen="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.ResetPassWord.IsOpen}">
  391. <view:ResetPassWordView />
  392. </hc:Drawer>
  393. <hc:Drawer
  394. Grid.Row="0"
  395. Grid.RowSpan="2"
  396. Grid.ColumnSpan="2"
  397. Dock="Top"
  398. IsOpen="{Binding Source={StaticResource MainViewModel}, Path=Data.SystemConfig.UserPage.AddUserViewModel.IsOpen}">
  399. <view:AddUserView />
  400. </hc:Drawer>
  401. <hc:Drawer
  402. Grid.Row="0"
  403. Grid.RowSpan="2"
  404. Grid.ColumnSpan="2"
  405. DataContext="{Binding Source={StaticResource Prompt}, Path=Data}"
  406. Dock="Top"
  407. IsOpen="{Binding IsOpen}">
  408. <Border
  409. Width="{x:Static SystemParameters.PrimaryScreenWidth}"
  410. Height="{x:Static SystemParameters.PrimaryScreenHeight}"
  411. Background="#9FAAAAAA">
  412. <Border
  413. Width="560"
  414. Height="340"
  415. Background="Gray"
  416. CornerRadius="6">
  417. <Grid>
  418. <Grid.RowDefinitions>
  419. <RowDefinition Height="66" />
  420. <RowDefinition Height="2*" />
  421. <RowDefinition Height="*" />
  422. </Grid.RowDefinitions>
  423. <Border
  424. Grid.ColumnSpan="2"
  425. Background="{StaticResource TitleBackColor}"
  426. CornerRadius="6,6,0,0">
  427. <TextBlock
  428. HorizontalAlignment="Center"
  429. VerticalAlignment="Center"
  430. FontSize="32"
  431. FontWeight="Bold"
  432. Foreground="White"
  433. Text="{Binding Title}" />
  434. </Border>
  435. <StackPanel
  436. Grid.Row="1"
  437. HorizontalAlignment="Center"
  438. VerticalAlignment="Center"
  439. Orientation="Horizontal">
  440. <Viewbox
  441. Grid.Row="1"
  442. Grid.Column="0"
  443. Width="60"
  444. Height="60"
  445. HorizontalAlignment="Center"
  446. VerticalAlignment="Center"
  447. Visibility="{Binding IconVisibility}">
  448. <Path Data="{Binding IconGeometry, Mode=OneWay}" Fill="{Binding IconBrush}" />
  449. </Viewbox>
  450. <TextBlock
  451. Grid.Row="1"
  452. Grid.Column="1"
  453. MaxWidth="420"
  454. Margin="20"
  455. HorizontalAlignment="Left"
  456. VerticalAlignment="Center"
  457. FontSize="20"
  458. Foreground="White"
  459. Text="{Binding Message}"
  460. TextWrapping="Wrap" />
  461. </StackPanel>
  462. <StackPanel
  463. Grid.Row="2"
  464. Grid.ColumnSpan="2"
  465. HorizontalAlignment="Center"
  466. VerticalAlignment="Center"
  467. Orientation="Horizontal">
  468. <Button
  469. Width="88"
  470. Height="38"
  471. Command="{Binding YesCommand}"
  472. Content="{Binding YesText}"
  473. Cursor="Hand"
  474. FontSize="16"
  475. ToolTip="{Binding YesText}"
  476. Visibility="{Binding YesVisibility}" />
  477. <Button
  478. Width="88"
  479. Height="38"
  480. Margin="40,0,0,0"
  481. Command="{Binding NoCommand}"
  482. Content="{Binding NoText}"
  483. Cursor="Hand"
  484. FontSize="16"
  485. ToolTip="{Binding NoText}"
  486. Visibility="{Binding NoVisibility}" />
  487. </StackPanel>
  488. </Grid>
  489. </Border>
  490. </Border>
  491. </hc:Drawer>
  492. <hc:Drawer
  493. Grid.Row="0"
  494. Grid.RowSpan="2"
  495. Grid.ColumnSpan="2"
  496. DataContext="{Binding Source={StaticResource Login}, Path=Data}"
  497. Dock="Top"
  498. IsOpen="{Binding IsLoggedIn, Converter={StaticResource Boolean2BooleanReConverter}}">
  499. <Grid
  500. Width="{x:Static SystemParameters.PrimaryScreenWidth}"
  501. Height="{x:Static SystemParameters.PrimaryScreenHeight}"
  502. Background="#9FAAAAAA">
  503. <Grid Width="620" Height="440">
  504. <Border
  505. Background="White"
  506. BorderBrush="{StaticResource BorderBrush}"
  507. BorderThickness="1"
  508. CornerRadius="6">
  509. <Border.Effect>
  510. <BlurEffect
  511. KernelType="Box"
  512. Radius="1"
  513. RenderingBias="Quality" />
  514. </Border.Effect>
  515. </Border>
  516. <Grid
  517. Width="400"
  518. Height="420"
  519. Margin="10"
  520. HorizontalAlignment="Center"
  521. VerticalAlignment="Center">
  522. <Grid.RowDefinitions>
  523. <RowDefinition Height="100" />
  524. <RowDefinition />
  525. <RowDefinition />
  526. <RowDefinition Height="32" />
  527. <RowDefinition />
  528. </Grid.RowDefinitions>
  529. <TextBlock
  530. HorizontalAlignment="Center"
  531. VerticalAlignment="Center"
  532. FontSize="42"
  533. Foreground="{StaticResource TitleBrush}"
  534. Text="用户登录" />
  535. <StackPanel
  536. Grid.Row="1"
  537. Height="42"
  538. Orientation="Horizontal">
  539. <TextBlock
  540. HorizontalAlignment="Right"
  541. VerticalAlignment="Center"
  542. FontSize="16"
  543. Text="用户名:" />
  544. <hc:WatermarkTextBox
  545. Width="320"
  546. Height="32"
  547. Margin="10,0,0,0"
  548. VerticalAlignment="Center"
  549. VerticalContentAlignment="Center"
  550. hc:BorderElement.CornerRadius="4"
  551. BorderBrush="{StaticResource BorderBrush}"
  552. BorderThickness="1"
  553. CaretBrush="Black"
  554. FontSize="16"
  555. Foreground="Black"
  556. InputScope="AlphanumericHalfWidth"
  557. MaxLength="20"
  558. Text="{Binding UserName}"
  559. Watermark="输入用户名" />
  560. </StackPanel>
  561. <StackPanel
  562. Grid.Row="2"
  563. Height="42"
  564. Orientation="Horizontal">
  565. <TextBlock
  566. HorizontalAlignment="Right"
  567. VerticalAlignment="Center"
  568. FontSize="16"
  569. Text=" 密码:" />
  570. <hc:PasswordBox
  571. Width="320"
  572. Height="32"
  573. Margin="10,0,0,0"
  574. VerticalAlignment="Center"
  575. VerticalContentAlignment="Center"
  576. hc:InfoElement.Placeholder="输入密码"
  577. Background="Transparent"
  578. BorderBrush="{StaticResource BorderBrush}"
  579. BorderThickness="1"
  580. CaretBrush="Black"
  581. FontSize="16"
  582. Foreground="Black"
  583. IsSafeEnabled="False"
  584. MaxLength="20"
  585. ShowEyeButton="True"
  586. UnsafePassword="{Binding PassWord}">
  587. <hc:PasswordBox.InputBindings>
  588. <KeyBinding Key="Enter" Command="{Binding LoginCommand}" />
  589. </hc:PasswordBox.InputBindings>
  590. </hc:PasswordBox>
  591. </StackPanel>
  592. <TextBlock
  593. Grid.Row="3"
  594. Foreground="Red"
  595. Text="{Binding Message}" />
  596. <StackPanel
  597. Grid.Row="4"
  598. HorizontalAlignment="Center"
  599. VerticalAlignment="Center"
  600. Orientation="Horizontal">
  601. <Button
  602. Width="120"
  603. Height="36"
  604. Command="{Binding LoginCommand}"
  605. Content="登录"
  606. Cursor="Hand"
  607. FontSize="16"
  608. Foreground="Black" />
  609. <Button
  610. Width="120"
  611. Height="36"
  612. Margin="40,0,0,0"
  613. Command="{Binding Source={StaticResource MainViewModel}, Path=Data.ShutDownCommand}"
  614. Content="退出"
  615. Cursor="Hand"
  616. FontSize="16"
  617. Foreground="Black" />
  618. </StackPanel>
  619. </Grid>
  620. </Grid>
  621. <Button
  622. Margin="0,0,10,10"
  623. HorizontalAlignment="Right"
  624. VerticalAlignment="Bottom"
  625. BorderThickness="0"
  626. Command="{Binding Source={StaticResource Login}, Path=Data.AnonymousLoginCommand}"
  627. Content="匿名登录"
  628. FontSize="22"
  629. Foreground="Blue"
  630. ToolTip="匿名登录">
  631. <Button.Style>
  632. <Style TargetType="{x:Type Button}">
  633. <Setter Property="Cursor" Value="Hand" />
  634. <Setter Property="Template">
  635. <Setter.Value>
  636. <ControlTemplate TargetType="{x:Type Button}">
  637. <TextBlock
  638. x:Name="text"
  639. Text="{TemplateBinding Content}"
  640. TextDecorations="Underline" />
  641. <ControlTemplate.Triggers>
  642. <Trigger Property="IsMouseOver" Value="True">
  643. <Setter TargetName="text" Property="Foreground" Value="Red" />
  644. </Trigger>
  645. </ControlTemplate.Triggers>
  646. </ControlTemplate>
  647. </Setter.Value>
  648. </Setter>
  649. </Style>
  650. </Button.Style>
  651. </Button>
  652. </Grid>
  653. </hc:Drawer>
  654. </Grid>
  655. </Viewbox>
  656. </Window>