MainPage.xaml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <Window x:Class="Muchinfo.MTPClient.UI.Views.MainPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:button="clr-namespace:Muchinfo.WPF.Controls.Button;assembly=Client.WPF.Controls"
  5. xmlns:command="http://www.galasoft.ch/mvvmlight"
  6. xmlns:converters="clr-namespace:Muchinfo.MTPClient.Infrastructure.Converters;assembly=Client.Infrastructure"
  7. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  8. xmlns:data="clr-namespace:Muchinfo.MTPClient.Data;assembly=Client.Data"
  9. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  10. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  11. xmlns:password="clr-namespace:Muchinfo.WPF.Controls.Password;assembly=Client.WPF.Controls"
  12. xmlns:resource="clr-namespace:Muchinfo.MTPClient.Resources;assembly=Client.Resources"
  13. xmlns:views="clr-namespace:Muchinfo.MTPClient.UI.Views"
  14. Title="{Binding SystemName}"
  15. MinWidth="800"
  16. MinHeight="600"
  17. Icon="{StaticResource WindowIconImageSource}"
  18. Style="{DynamicResource NoBorderWindow}"
  19. WindowStartupLocation="CenterScreen"
  20. mc:Ignorable="d">
  21. <Window.Resources>
  22. <HierarchicalDataTemplate x:Key="MenuHierarchicalTemplate"
  23. DataType="{x:Type data:SysMenuItem}"
  24. ItemsSource="{Binding Children}">
  25. <TextBlock MinWidth="30"
  26. Foreground="{DynamicResource MainForegroundBrush}"
  27. Padding="3"
  28. Text="{Binding Title}" />
  29. </HierarchicalDataTemplate>
  30. <Style x:Key="MenuCommonItemStyle" TargetType="{x:Type MenuItem}">
  31. <Setter Property="Command" Value="{Binding Home.MenuCommand, Source={StaticResource Locator}}" />
  32. <Setter Property="CommandParameter" Value="{Binding}" />
  33. <Setter Property="IsCheckable" Value="{Binding IsCheckable}" />
  34. <Setter Property="IsChecked" Value="{Binding IsChecked, Mode=TwoWay}" />
  35. <Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
  36. <Setter Property="Background" Value="{DynamicResource WindowHeadBrush}" />
  37. <Setter Property="HorizontalContentAlignment" Value="Left" />
  38. <Setter Property="VerticalContentAlignment" Value="Center" />
  39. <Setter Property="BorderBrush" Value="{DynamicResource CommonBorderBrush}" />
  40. <Setter Property="BorderThickness" Value="0,0,0,1" />
  41. <Setter Property="Foreground" Value="{DynamicResource MainForegroundBrush}" />
  42. <Setter Property="Template" Value="{DynamicResource CommonMenuItemTemplate}" />
  43. </Style>
  44. <BooleanToVisibilityConverter x:Key="ToVisibilityConverter" />
  45. <converters:BoolOpposedVisibility x:Key="BoolOpposedVisibility" />
  46. </Window.Resources>
  47. <Window.InputBindings>
  48. <KeyBinding Command="{Binding FtenCommand}" Gesture="F10" />
  49. </Window.InputBindings>
  50. <Window.DataContext>
  51. <Binding Path="Home" Source="{StaticResource Locator}" />
  52. </Window.DataContext>
  53. <i:Interaction.Triggers>
  54. <i:EventTrigger EventName="Loaded">
  55. <command:EventToCommand Command="{Binding ViewLoadedCommand}" CommandParameter="{Binding ElementName=HomeView}" />
  56. </i:EventTrigger>
  57. </i:Interaction.Triggers>
  58. <Border>
  59. <Grid Background="{DynamicResource CommonBackgroundBrush}">
  60. <Grid.RowDefinitions>
  61. <RowDefinition Height="1" />
  62. <RowDefinition Height="*" />
  63. <RowDefinition Height="1" />
  64. </Grid.RowDefinitions>
  65. <Grid.ColumnDefinitions>
  66. <ColumnDefinition Width="1" />
  67. <ColumnDefinition Width="*" />
  68. <ColumnDefinition Width="1" />
  69. </Grid.ColumnDefinitions>
  70. <Grid x:Name="LayoutGird"
  71. Grid.RowSpan="3"
  72. Grid.ColumnSpan="3">
  73. <Grid.RowDefinitions>
  74. <RowDefinition Height="Auto" />
  75. <RowDefinition Height="*" />
  76. <RowDefinition Height="Auto" />
  77. </Grid.RowDefinitions>
  78. <!-- 菜单栏 -->
  79. <Grid x:Name="MenuBarGrid"
  80. Grid.Row="0"
  81. Grid.ColumnSpan="2"
  82. Height="33"
  83. Background="{DynamicResource WindowHeadBrush}"
  84. MouseDown="Window_MouseDown">
  85. <Grid.ColumnDefinitions>
  86. <ColumnDefinition Width="Auto" />
  87. <ColumnDefinition Width="*" />
  88. <ColumnDefinition Width="Auto" />
  89. <ColumnDefinition Width="Auto" />
  90. <ColumnDefinition Width="8" />
  91. </Grid.ColumnDefinitions>
  92. <!--
  93. <StackPanel Grid.Column="0"
  94. HorizontalAlignment="Left"
  95. VerticalAlignment="Center"
  96. Orientation="Horizontal"
  97. Visibility="{Binding ListingAndMallVisibility,
  98. Mode=TwoWay}">
  99. <Grid DataContext="{Binding CurrentTradeAccount}">
  100. <Grid.ColumnDefinitions>
  101. <ColumnDefinition Width="*" />
  102. <ColumnDefinition Width="2*" />
  103. </Grid.ColumnDefinitions>
  104. <TextBlock Margin="10,0,0,0" Foreground="{DynamicResource MuchinfoBrush96}">
  105. <Run Text="{Binding CustomerName, Mode=OneWay}" />
  106. </TextBlock>
  107. <TextBlock Grid.Column="1"
  108. Margin="10,0,0,0"
  109. Foreground="{DynamicResource MuchinfoBrush97}">
  110. <Run Text="{x:Static resource:Client_Resource.Moduel_AccountLogin}" />
  111. <Run Text="{Binding LoginCode, Mode=OneWay}" />
  112. </TextBlock>
  113. </Grid>
  114. </StackPanel>
  115. -->
  116. <Grid Grid.Row="0"
  117. MinWidth="240"
  118. Margin="0,3"
  119. VerticalAlignment="Center"
  120. Panel.ZIndex="10">
  121. <Grid.ColumnDefinitions>
  122. <ColumnDefinition Width="Auto" />
  123. <ColumnDefinition Width="Auto" />
  124. <ColumnDefinition Width="*" />
  125. <ColumnDefinition Width="Auto" />
  126. </Grid.ColumnDefinitions>
  127. <Image Grid.Column="0"
  128. Width="21"
  129. Height="21"
  130. Margin="10,3"
  131. Source="{DynamicResource WindowIconImageSource}" />
  132. <Menu Grid.Column="1"
  133. Background="Transparent"
  134. ItemContainerStyle="{DynamicResource MenuCommonItemStyle}"
  135. ItemTemplate="{DynamicResource MenuHierarchicalTemplate}"
  136. ItemsSource="{Binding MainMenuItems}" />
  137. </Grid>
  138. <Grid Grid.Column="0" Grid.ColumnSpan="5">
  139. <Grid.ColumnDefinitions>
  140. <ColumnDefinition Width="*" />
  141. <ColumnDefinition Width="Auto" />
  142. </Grid.ColumnDefinitions>
  143. <TextBlock Grid.Column="0"
  144. HorizontalAlignment="Stretch"
  145. VerticalAlignment="Center"
  146. FontWeight="Normal"
  147. Foreground="{DynamicResource MainForegroundBrush}"
  148. Text="{Binding SystemName}"
  149. TextAlignment="Center" />
  150. <TextBlock Grid.Column="1"
  151. HorizontalAlignment="Right"
  152. VerticalAlignment="Center"
  153. FontWeight="Normal"
  154. Foreground="{DynamicResource MainForegroundBrush}"
  155. Text="{Binding TradeTypeDisplay}"
  156. TextAlignment="Center" />
  157. </Grid>
  158. <StackPanel Grid.Column="3"
  159. Margin="0,5,0,0"
  160. VerticalAlignment="Top"
  161. Orientation="Horizontal">
  162. <!--
  163. <RadioButton x:Name="OrderTransaction"
  164. Command="{Binding OrderTransactionCommand}"
  165. CommandParameter="0"
  166. Content="{x:Static resource:Client_Resource.OrderTranstion}"
  167. GroupName="group1"
  168. IsChecked="True"
  169. Style="{DynamicResource LeftToggleButtonStyel}" />
  170. <RadioButton x:Name="ListButton"
  171. Command="{Binding OrderTransactionCommand}"
  172. CommandParameter="1"
  173. Content="{x:Static resource:Client_Resource.Listing}"
  174. GroupName="group1"
  175. Style="{DynamicResource LeftToggleButtonStyel}" />
  176. <RadioButton x:Name="MallButton"
  177. Margin="0,0,20,0"
  178. Command="{Binding OrderTransactionCommand}"
  179. CommandParameter="2"
  180. Content="{x:Static resource:Client_Resource.Mall}"
  181. GroupName="group2"
  182. Style="{DynamicResource LeftToggleButtonStyel}" />
  183. -->
  184. <!--
  185. <CheckBox Width="28"
  186. Height="24"
  187. Margin="10,0,0,0" Visibility="{Binding IsAccountLogin ,Converter={StaticResource ToVisibilityConverter}}"
  188. IsChecked="{Binding IsTradeVisible}"
  189. Style="{DynamicResource AccountInfoCheckBoxStyle}" />
  190. <Button Width="28"
  191. Height="24"
  192. Margin="10,0,0,0"
  193. Background="Transparent"
  194. Click="TradeSet_OnClick"
  195. Padding="2"
  196. Style="{DynamicResource TextButtonStyle}"
  197. ToolTip="{x:Static resource:Client_Resource.TradeParamerSet_Title}">
  198. <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
  199. <Ellipse Width="12"
  200. Height="12"
  201. Stroke="{DynamicResource AcountGridHeadForeground}"
  202. StrokeThickness="1" />
  203. <TextBlock HorizontalAlignment="Center"
  204. VerticalAlignment="Center"
  205. Foreground="{DynamicResource AcountGridHeadForeground}"
  206. Text="?" />
  207. </Grid>
  208. </Button>
  209. -->
  210. <button:ImageButton Margin="0,-5,0,0"
  211. Click="WinMin_OnClick"
  212. ImageHeight="24"
  213. ImageWidth="28"
  214. Style="{StaticResource WindowMinImageStyle}" />
  215. <button:ImageButton x:Name="MaxImageButton"
  216. Margin="0,-5,0,0"
  217. Click="WinMax_OnClick"
  218. ImageHeight="24"
  219. ImageWidth="28"
  220. Style="{StaticResource WindowMaxImageStyle}" />
  221. <button:ImageButton Margin="0,-5,0,0"
  222. Click="WinClose_OnClick"
  223. ImageHeight="24"
  224. ImageWidth="42"
  225. Style="{StaticResource WindowCloseImageStyle}" />
  226. </StackPanel>
  227. </Grid>
  228. <Border x:Name="ContentBorder" Grid.Row="1">
  229. <ContentControl Content="{Binding MainContent}" />
  230. </Border>
  231. <Grid x:Name="KeyGrid"
  232. Grid.RowSpan="3"
  233. KeyDown="UIElement_OnKeyDown"
  234. KeyUp="LockScreenBGGrid_OnKeyUp"
  235. Visibility="{Binding IsLockScreen,
  236. Converter={StaticResource ToVisibilityConverter}}">
  237. <Grid Background="{DynamicResource LockScreenTanBrush}" Visibility="{Binding LockScreenType, Converter={StaticResource BoolOpposedVisibility}}">
  238. <Border Width="350"
  239. Height="150"
  240. Background="{DynamicResource ContextBackground}"
  241. BorderBrush="{DynamicResource TreeBorderBrush}"
  242. BorderThickness="1">
  243. <Grid VerticalAlignment="Center">
  244. <Grid.RowDefinitions>
  245. <RowDefinition />
  246. <RowDefinition />
  247. <RowDefinition Height="Auto" />
  248. </Grid.RowDefinitions>
  249. <Grid.ColumnDefinitions>
  250. <ColumnDefinition Width="Auto" />
  251. <ColumnDefinition />
  252. </Grid.ColumnDefinitions>
  253. <TextBlock Margin="5,0,0,0"
  254. HorizontalAlignment="Right"
  255. VerticalAlignment="Center"
  256. Foreground="{DynamicResource MainForegroundBrush}"
  257. Text="{x:Static resource:Client_Resource.Lock_InputPasswordError}" />
  258. <PasswordBox x:Name="UnlockPasswordBox"
  259. Grid.Column="1"
  260. Width="200"
  261. MinHeight="25"
  262. Margin="5,10"
  263. HorizontalAlignment="Left"
  264. VerticalAlignment="Center"
  265. Focusable="True"
  266. IsVisibleChanged="UIElement_OnIsVisibleChanged"
  267. Style="{DynamicResource AccountPasswordBoxStyle}"
  268. TabIndex="1"
  269. password:PasswordHelper.Attach="True"
  270. password:PasswordHelper.Password="{Binding Password,
  271. Mode=TwoWay,
  272. UpdateSourceTrigger=PropertyChanged}" />
  273. <StackPanel Grid.Row="1"
  274. Grid.ColumnSpan="2"
  275. HorizontalAlignment="Center"
  276. Orientation="Horizontal">
  277. <Button x:Name="btnUnlock"
  278. VerticalAlignment="Center"
  279. Command="{Binding UnLockCommand}"
  280. CommandParameter="{Binding ElementName=LockWindow}"
  281. Content="{x:Static resource:Client_Resource.Lock_Btn_text}"
  282. Padding="10,2"
  283. Style="{DynamicResource CommonButtonStyle}" />
  284. <Button Margin="40,0,0,0"
  285. VerticalAlignment="Center"
  286. Command="{Binding LoginOutCommand}"
  287. Content="{x:Static resource:Client_Resource.Lock_Btn_LogoutText}"
  288. IsCancel="True"
  289. Padding="10,2"
  290. Style="{DynamicResource CommonButtonStyle}" />
  291. </StackPanel>
  292. <TextBlock Grid.Row="2"
  293. HorizontalAlignment="Center"
  294. Text="{Binding ErrorMsg}" />
  295. </Grid>
  296. </Border>
  297. </Grid>
  298. <Grid x:Name="LockScreenBGGrid" Visibility="{Binding LockScreenType, Converter={StaticResource ToVisibilityConverter}}">
  299. <Image x:Name="LockScreenBGIMG"
  300. Opacity="1"
  301. Source="{DynamicResource LockScreenBGIMG}"
  302. Stretch="Fill" />
  303. <Image x:Name="LogoIcon"
  304. Width="350"
  305. Height="60"
  306. Margin="0,70"
  307. HorizontalAlignment="Center"
  308. VerticalAlignment="Top"
  309. Opacity="1"
  310. Source="{DynamicResource LogoIcon}" />
  311. <button:ImageButton Width="52"
  312. Height="52"
  313. Margin="30,30"
  314. HorizontalAlignment="Right"
  315. VerticalAlignment="Top"
  316. Background="Transparent"
  317. Command="{Binding LoginOutCommand}">
  318. <Image x:Name="LogoutButtonIcon" Source="{DynamicResource LogoutButtonIcon}" />
  319. </button:ImageButton>
  320. <StackPanel Margin="0,160,0,0"
  321. HorizontalAlignment="Center"
  322. VerticalAlignment="Center"
  323. Orientation="Horizontal">
  324. <PasswordBox x:Name="Password"
  325. Width="350"
  326. MinHeight="25"
  327. Margin="5,10"
  328. HorizontalAlignment="Left"
  329. VerticalAlignment="Center"
  330. IsVisibleChanged="UIElement_OnIsVisibleChanged"
  331. Style="{DynamicResource LoginPasswordBoxStyle}"
  332. TabIndex="1"
  333. password:PasswordHelper.Attach="True"
  334. password:PasswordHelper.Password="{Binding Password,
  335. Mode=TwoWay,
  336. UpdateSourceTrigger=PropertyChanged}" />
  337. <Button x:Name="btnUnlock2"
  338. VerticalAlignment="Center"
  339. Command="{Binding UnLockCommand}"
  340. CommandParameter="{Binding ElementName=LockWindow}"
  341. Content="{x:Static resource:Client_Resource.Lock_Btn_text}"
  342. Padding="10,2"
  343. Style="{DynamicResource CommonButtonStyle}" />
  344. </StackPanel>
  345. </Grid>
  346. </Grid>
  347. <!-- 状态栏 -->
  348. <StackPanel Grid.Row="2"
  349. Grid.ColumnSpan="2"
  350. Orientation="Vertical"
  351. Visibility="{Binding StatusbarVisibility}">
  352. <!-- 分隔线 -->
  353. <Separator Panel.ZIndex="10"
  354. BorderBrush="{DynamicResource TreeBorderBrush}"
  355. Style="{DynamicResource ThinSeparatorStyle}" />
  356. <Separator Panel.ZIndex="10"
  357. BorderBrush="{DynamicResource CommonBackground}"
  358. Style="{DynamicResource ThinSeparatorStyle}" />
  359. <!-- <Separator Style="{DynamicResource ThinSeparatorStyle}" /> -->
  360. <views:StatusBarControl Background="{DynamicResource WindowHeadBrush}" />
  361. </StackPanel>
  362. <!--
  363. <Grid x:Name="LockSreenGrid"
  364. Grid.Row="0"
  365. Grid.RowSpan="3"
  366. Visibility="{Binding MainPanelVisibility,
  367. Mode=TwoWay}"
  368. d:IsHidden="True">
  369. <Button Background="{DynamicResource LockScreenBrush}" BorderThickness="0" />
  370. </Grid>
  371. -->
  372. </Grid>
  373. <Rectangle x:Name="TopLeftBorder"
  374. Grid.Row="0"
  375. Grid.Column="0"
  376. Fill="{DynamicResource MainOuterBoderBrush}" />
  377. <Rectangle x:Name="TopBorder"
  378. Grid.Row="0"
  379. Grid.Column="1"
  380. Fill="{DynamicResource MainOuterBoderBrush}" />
  381. <Rectangle x:Name="TopRightBorder"
  382. Grid.Row="0"
  383. Grid.Column="2"
  384. Fill="{DynamicResource MainOuterBoderBrush}" />
  385. <Rectangle x:Name="RightBorder"
  386. Grid.Row="1"
  387. Grid.Column="2"
  388. Fill="{DynamicResource MainOuterBoderBrush}" />
  389. <Rectangle x:Name="BottomRightBorder"
  390. Grid.Row="2"
  391. Grid.Column="2"
  392. Fill="{DynamicResource MainOuterBoderBrush}" />
  393. <Rectangle x:Name="BottomBorder"
  394. Grid.Row="2"
  395. Grid.Column="1"
  396. Fill="{DynamicResource MainOuterBoderBrush}" />
  397. <Rectangle x:Name="BottomLeftBorder"
  398. Grid.Row="2"
  399. Grid.Column="0"
  400. Fill="{DynamicResource MainOuterBoderBrush}" />
  401. <Rectangle x:Name="LeftBorder"
  402. Grid.Row="1"
  403. Grid.Column="0"
  404. Fill="{DynamicResource MainOuterBoderBrush}" />
  405. </Grid>
  406. </Border>
  407. </Window>