MainWindow.xaml 38 KB

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