StatusBarControl.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <UserControl x:Class="Muchinfo.MTPClient.UI.Views.StatusBarControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:converters="clr-namespace:Muchinfo.MTPClient.Infrastructure.Converters;assembly=Client.Infrastructure"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:resource="clr-namespace:Muchinfo.MTPClient.Resources;assembly=Client.Resources"
  9. DataContext="{Binding StatusBar,
  10. Source={StaticResource Locator}}"
  11. mc:Ignorable="d">
  12. <UserControl.Resources>
  13. <BooleanToVisibilityConverter x:Key="BooleanToVisibility" />
  14. <converters:BoolOpposedVisibility x:Key="OpposedVisibility" />
  15. <Style x:Key="BarItemStyle" TargetType="{x:Type StatusBarItem}">
  16. <Setter Property="HorizontalAlignment" Value="Stretch" />
  17. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  18. <Setter Property="BorderThickness" Value="1,0" />
  19. </Style>
  20. <Style x:Key="StatusListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
  21. <Setter Property="HorizontalContentAlignment" Value="Center" />
  22. <Setter Property="VerticalContentAlignment" Value="Center" />
  23. <Setter Property="Padding" Value="2,0,0,0" />
  24. <Setter Property="BorderThickness" Value="0,0,1,0" />
  25. <Setter Property="Template">
  26. <Setter.Value>
  27. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  28. <Border x:Name="Bd"
  29. Background="{TemplateBinding Background}"
  30. BorderBrush="{TemplateBinding BorderBrush}"
  31. BorderThickness="{TemplateBinding BorderThickness}"
  32. Padding="{TemplateBinding Padding}"
  33. SnapsToDevicePixels="true">
  34. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  35. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  36. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  37. </Border>
  38. </ControlTemplate>
  39. </Setter.Value>
  40. </Setter>
  41. </Style>
  42. <!--
  43. <Style x:Key="StatusListBoxStyle" TargetType="{x:Type ListBox}">
  44. <Setter Property="BorderThickness" Value="0" />
  45. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
  46. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
  47. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  48. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  49. <Setter Property="VerticalAlignment" Value="Center" />
  50. <Setter Property="ItemsPanel">
  51. <Setter.Value>
  52. <ItemsPanelTemplate>
  53. <StackPanel Orientation="Horizontal" />
  54. </ItemsPanelTemplate>
  55. </Setter.Value>
  56. </Setter>
  57. <Setter Property="Template">
  58. <Setter.Value>
  59. <ControlTemplate TargetType="{x:Type ListBox}">
  60. <themes:ClassicBorderDecorator x:Name="Bd"
  61. Background="{TemplateBinding Background}"
  62. BorderBrush="{TemplateBinding BorderBrush}"
  63. BorderStyle="Sunken"
  64. BorderThickness="{TemplateBinding BorderThickness}"
  65. SnapsToDevicePixels="true">
  66. <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
  67. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  68. </ScrollViewer>
  69. </themes:ClassicBorderDecorator>
  70. <ControlTemplate.Triggers>
  71. <Trigger Property="IsEnabled" Value="false">
  72. <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  73. </Trigger>
  74. <Trigger Property="IsGrouping" Value="true">
  75. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  76. </Trigger>
  77. </ControlTemplate.Triggers>
  78. </ControlTemplate>
  79. </Setter.Value>
  80. </Setter>
  81. </Style>
  82. -->
  83. <DataTemplate x:Key="StatusDataTemplate">
  84. <Grid Margin="10,0" Background="{DynamicResource MuchinfoBrush2}">
  85. <Grid.ColumnDefinitions>
  86. <ColumnDefinition Width="4*" />
  87. <ColumnDefinition Width="6*" />
  88. </Grid.ColumnDefinitions>
  89. <TextBlock HorizontalAlignment="Center"
  90. Foreground="{Binding IncreaseValueColor,
  91. Mode=OneWay}"
  92. Text="{Binding Name}" />
  93. <TextBlock Grid.Column="1"
  94. Margin="5,0"
  95. Foreground="{Binding IncreaseValueColor,
  96. Mode=OneWay}">
  97. <Run Text="{Binding CurrentPriceDisplay, Mode=OneWay}" />
  98. <Run Text="/" />
  99. <Run Text="{Binding IncreasePercentDisplay, Mode=OneWay}" />
  100. </TextBlock>
  101. </Grid>
  102. </DataTemplate>
  103. </UserControl.Resources>
  104. <Grid>
  105. <StatusBar Height="24" Background="{DynamicResource AccountInfoBackground}">
  106. <StatusBar.ItemsPanel>
  107. <ItemsPanelTemplate>
  108. <Grid>
  109. <Grid.ColumnDefinitions>
  110. <ColumnDefinition Width="Auto" />
  111. <ColumnDefinition Width="*" />
  112. <ColumnDefinition Width="Auto" />
  113. <ColumnDefinition Width="Auto" />
  114. <ColumnDefinition Width="Auto" />
  115. <ColumnDefinition Width="Auto" />
  116. <ColumnDefinition Width="Auto" />
  117. </Grid.ColumnDefinitions>
  118. </Grid>
  119. </ItemsPanelTemplate>
  120. </StatusBar.ItemsPanel>
  121. <StatusBarItem Grid.Column="0">
  122. <StackPanel Orientation="Horizontal" Visibility="{Binding IsAccountVisible, Converter={StaticResource BooleanToVisibility}}">
  123. <Image Width="12"
  124. Height="12"
  125. Margin="10,0,5,0"
  126. Source="{DynamicResource AccountIcon}" />
  127. <TextBlock VerticalAlignment="Center" Foreground="{DynamicResource AccountInfoForeground2}">
  128. <Run Text="{x:Static resource:Client_Resource.Moduel_AccountLogin}" />
  129. <Run Text="{Binding LoginID, Mode=OneWay}" />
  130. </TextBlock>
  131. <TextBlock Margin="20,0,0,0"
  132. VerticalAlignment="Center"
  133. Foreground="{DynamicResource AccountInfoForeground2}">
  134. <Run Text="{Binding CustomerName, Mode=OneWay}" />
  135. </TextBlock>
  136. <TextBlock Margin="20,0,0,0"
  137. VerticalAlignment="Center"
  138. Foreground="{DynamicResource AccountInfoForeground2}">
  139. <Run Text="{Binding AccountStatus, Mode=OneWay}" />
  140. </TextBlock>
  141. </StackPanel>
  142. </StatusBarItem>
  143. <!--
  144. <StatusBarItem MinWidth="50"
  145. Style="{DynamicResource BarItemStyle}"
  146. ToolTip="单击右键设置关注商品">
  147. <ListBox Name="FocusGoodsListBox"
  148. Cursor="Hand"
  149. ItemContainerStyle="{DynamicResource StatusListBoxItemStyle}"
  150. ItemTemplate="{DynamicResource StatusDataTemplate}"
  151. ItemsSource="{Binding IndicatorsGoodses}"
  152. SelectedItem="{Binding CurrentGoods,
  153. Mode=TwoWay}"
  154. Style="{DynamicResource StatusListBoxStyle}"
  155. ToolTip="单击左键查看关注商品分析表">
  156. <i:Interaction.Triggers>
  157. <i:EventTrigger EventName="MouseLeftButtonUp">
  158. <i:InvokeCommandAction Command="{Binding FocusGoodsSelectedCommand}" />
  159. </i:EventTrigger>
  160. </i:Interaction.Triggers>
  161. </ListBox>
  162. <i:Interaction.Triggers>
  163. <i:EventTrigger EventName="MouseRightButtonUp">
  164. <i:InvokeCommandAction Command="{Binding FocusGoodsUpdateCommand}" />
  165. </i:EventTrigger>
  166. </i:Interaction.Triggers>
  167. </StatusBarItem>
  168. <StatusBarItem Grid.Column="1" Style="{DynamicResource BarItemStyle}">
  169. <marQuees:CutOverControl Name="CutOverControl"
  170. DelayTime="00:00:05"
  171. Foreground="CornflowerBlue"
  172. ItemsSource="{Binding NewsTitleList}">
  173. <marQuees:CutOverControl.ItemTemplate>
  174. <DataTemplate>
  175. <TextBlock Text="{Binding Title}">
  176. <i:Interaction.Triggers>
  177. <i:EventTrigger EventName="MouseLeftButtonUp">
  178. <i:InvokeCommandAction Command="{Binding StatusBar.OpenNewsCommand, Source={StaticResource Locator}}" CommandParameter="{Binding NewsID}" />
  179. </i:EventTrigger>
  180. </i:Interaction.Triggers>
  181. </TextBlock>
  182. </DataTemplate>
  183. </marQuees:CutOverControl.ItemTemplate>
  184. </marQuees:CutOverControl>
  185. </StatusBarItem>
  186. <StatusBarItem Grid.Column="2" Padding="0" />
  187. -->
  188. <StatusBarItem Grid.Column="2">
  189. <TextBlock Foreground="{DynamicResource MainForegroundBrush}"><Run Text="{Binding ErrorMessage, Mode=OneWay}" /><Run Text=" " />
  190. </TextBlock>
  191. </StatusBarItem>
  192. <StatusBarItem Grid.Column="3"
  193. Margin="5,0"
  194. HorizontalContentAlignment="Right">
  195. <TextBlock Foreground="{DynamicResource MainForegroundBrush}"><Run Text="{Binding Version, Mode=OneWay}" />
  196. </TextBlock>
  197. </StatusBarItem>
  198. <StatusBarItem Grid.Column="4" Padding="0">
  199. <StackPanel Orientation="Horizontal">
  200. <!--
  201. <Image Width="24"
  202. Height="24"
  203. Margin="0,0,5,0"
  204. Source="{DynamicResource StatusbarWaring}">
  205. <i:Interaction.Triggers>
  206. <i:EventTrigger EventName="MouseLeftButtonUp">
  207. <i:InvokeCommandAction Command="{Binding StatusBar.OpenWarningCommand, Source={StaticResource Locator}}" />
  208. </i:EventTrigger>
  209. </i:Interaction.Triggers>
  210. </Image>
  211. -->
  212. <!--
  213. <Image Width="20"
  214. Height="20"
  215. Source="{DynamicResource Status_alarmImage_p}"
  216. ToolTip="{Binding AlarmString}"
  217. Visibility="{Binding IsSyncVisible,
  218. Converter={StaticResource BooleanToVisibility}}" />
  219. -->
  220. <!--
  221. <Border Margin="0,0,20,2">
  222. <Image Width="20"
  223. Height="20"
  224. Source="{Binding NetStatusImageSource}">
  225. <i:Interaction.Triggers>
  226. <i:EventTrigger EventName="MouseLeftButtonUp">
  227. <i:InvokeCommandAction Command="{Binding StatusBar.OpenNetStatusCommand, Source={StaticResource Locator}}" />
  228. </i:EventTrigger>
  229. </i:Interaction.Triggers>
  230. </Image>
  231. <Border.Style>
  232. <Style TargetType="Border">
  233. <Style.Triggers>
  234. <Trigger Property="IsMouseOver" Value="True">
  235. <Setter Property="BorderThickness" Value="1" />
  236. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush10}" />
  237. </Trigger>
  238. </Style.Triggers>
  239. </Style>
  240. </Border.Style>
  241. </Border>
  242. -->
  243. <!--
  244. 交易连接 Visibility="{Binding TradeVisible,
  245. Converter={StaticResource BooleanToVisibility}}"
  246. -->
  247. <Grid Margin="5,0">
  248. <Image Width="20"
  249. Height="20"
  250. Source="{DynamicResource TradeConnectImageSource}"
  251. ToolTip="{x:Static resource:Client_Resource.Text_State_TradeNormal}"
  252. Visibility="{Binding IsTradeConnect,
  253. Converter={StaticResource BooleanToVisibility}}" />
  254. <Image Width="20"
  255. Height="20"
  256. Source="{DynamicResource DisTradeConnectImageSource}"
  257. ToolTip="{x:Static resource:Client_Resource.Text_State_TradeDisconnect}"
  258. Visibility="{Binding IsTradeConnect,
  259. Converter={StaticResource OpposedVisibility}}" />
  260. </Grid>
  261. <!--
  262. 交易行情连接 Visibility="{Binding TradeQuoteVisible,
  263. Converter={StaticResource BooleanToVisibility}}"
  264. -->
  265. <Grid Margin="5,0">
  266. <Image Width="20"
  267. Height="20"
  268. Source="{DynamicResource QuoteConnectImageSource}"
  269. ToolTip="{x:Static resource:Client_Resource.Text_State_TradeQuoteNormal}"
  270. Visibility="{Binding IsQuoteConnect,
  271. Converter={StaticResource BooleanToVisibility}}" />
  272. <Image Width="20"
  273. Height="20"
  274. Source="{DynamicResource DisQuoteConnectCloseImageSource}"
  275. ToolTip="{x:Static resource:Client_Resource.Text_State_TradeQuoteDisconnect}"
  276. Visibility="{Binding IsQuoteConnect,
  277. Converter={StaticResource OpposedVisibility}}" />
  278. </Grid>
  279. <!-- 游客行情连接 -->
  280. <Grid Margin="5,0" Visibility="{Binding GuestQuoteVisible, Converter={StaticResource BooleanToVisibility}}">
  281. <Image Width="20"
  282. Height="20"
  283. Source="{DynamicResource QuoteConnectImageSource}"
  284. ToolTip="{x:Static resource:Client_Resource.Text_State_GuestQuoteNormal}"
  285. Visibility="{Binding IsGuestConnect,
  286. Converter={StaticResource BooleanToVisibility}}" />
  287. <Image Width="20"
  288. Height="20"
  289. Source="{DynamicResource DisQuoteConnectCloseImageSource}"
  290. ToolTip="{x:Static resource:Client_Resource.Text_State_GuestQuoteDisconnect}"
  291. Visibility="{Binding IsGuestConnect,
  292. Converter={StaticResource OpposedVisibility}}" />
  293. </Grid>
  294. </StackPanel>
  295. </StatusBarItem>
  296. <StatusBarItem Grid.Column="5">
  297. <!-- <Run Text="当前时间:" /> -->
  298. <TextBlock Foreground="{DynamicResource MainForegroundBrush}"><Run Text="{Binding CurrentTime}" />
  299. </TextBlock>
  300. </StatusBarItem>
  301. </StatusBar>
  302. </Grid>
  303. </UserControl>