TopView.xaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <UserControl x:Class="Aitex.Sorter.UI.Views.TopView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:coreControl="clr-namespace:Aitex.Core.UI.Control;assembly=MECF.Framework.UI.Core"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
  8. xmlns:controls="clr-namespace:Aitex.Sorter.UI.Controls"
  9. mc:Ignorable="d"
  10. Background="{StaticResource mainBackgroundColor}"
  11. d:DesignHeight="130" d:DesignWidth="1920" >
  12. <UserControl.Resources>
  13. <LinearGradientBrush x:Key="buttonNormal" StartPoint="0.5,0" EndPoint="0.5,1">
  14. <GradientStop Color="#9cd7f7" Offset="0" />
  15. <GradientStop Color="#56b6e6" Offset="1" />
  16. </LinearGradientBrush>
  17. <SolidColorBrush x:Key="buttonForground" Color="#035092"></SolidColorBrush>
  18. <SolidColorBrush x:Key="buttonBorder" Color="#83c7eb"></SolidColorBrush>
  19. <LinearGradientBrush x:Key="buttonHover" StartPoint="0.5,0" EndPoint="0.5,1">
  20. <GradientStop Color="#668fa5" Offset="0" />
  21. <GradientStop Color="#3c6982" Offset="1" />
  22. </LinearGradientBrush>
  23. <Style x:Key="txtStatus" TargetType="TextBlock">
  24. <!--<Setter Property="Background" Value="#035092" />-->
  25. <Setter Property="Foreground" Value="DarkSlateGray" />
  26. <Setter Property="Padding" Value="5,5,0,0" />
  27. <Setter Property="FontSize" Value="18"/>
  28. </Style>
  29. <Style x:Key="TopPanelStatus" TargetType="TextBlock">
  30. <Setter Property="Foreground" Value="DarkSlateGray" />
  31. <Setter Property="Padding" Value="5" />
  32. <Setter Property="FontSize" Value="16"/>
  33. <Setter Property="TextAlignment" Value="Center"/>
  34. </Style>
  35. <Style x:Key="logoutButton" TargetType="Button">
  36. <Setter Property="Background" Value="{StaticResource buttonNormal}"></Setter>
  37. <Setter Property="Foreground" Value="{StaticResource buttonForground}"></Setter>
  38. <Setter Property="BorderBrush" Value="{StaticResource buttonBorder}"></Setter>
  39. <Setter Property="Template">
  40. <Setter.Value>
  41. <ControlTemplate TargetType="{x:Type Button}">
  42. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"
  43. SnapsToDevicePixels="true" CornerRadius="3,3,3,3">
  44. <ContentPresenter x:Name="contentPresenter"
  45. Focusable="False"
  46. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  47. Margin="{TemplateBinding Padding}"
  48. RecognizesAccessKey="True"
  49. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  50. VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  51. </Border>
  52. <ControlTemplate.Triggers>
  53. <Trigger Property="IsMouseOver" Value="true">
  54. <Setter Property="Background" TargetName="border" Value="{StaticResource buttonHover}"/>
  55. </Trigger>
  56. </ControlTemplate.Triggers>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. </Style>
  61. <Style TargetType="ToggleButton" x:Key="ComboxStyleBtn">
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate>
  65. <!--下拉按钮内部背景色-->
  66. <Border x:Name="Back" Background="#56b6e6" BorderThickness="1" BorderBrush="Transparent">
  67. <!--下拉按钮内边框-->
  68. <Path Name="PathFill" Fill="#03ffea" Width="10" Height="6" StrokeThickness="0" Data="M5,0 L10,10 L0,10 z" RenderTransformOrigin="0.5,0.5" Stretch="Fill">
  69. <Path.RenderTransform>
  70. <TransformGroup>
  71. <ScaleTransform/>
  72. <SkewTransform/>
  73. <RotateTransform Angle="180"/>
  74. <TranslateTransform/>
  75. </TransformGroup>
  76. </Path.RenderTransform>
  77. </Path>
  78. </Border>
  79. <ControlTemplate.Triggers>
  80. <Trigger Property="IsMouseOver" Value="True">
  81. <Setter TargetName="PathFill" Property="Fill" Value="White"></Setter>
  82. </Trigger>
  83. </ControlTemplate.Triggers>
  84. </ControlTemplate>
  85. </Setter.Value>
  86. </Setter>
  87. </Style>
  88. <!--Combox-->
  89. <Style TargetType="ComboBox" x:Key="ComboBoxStyle">
  90. <Setter Property="ItemContainerStyle">
  91. <Setter.Value>
  92. <!--ComBoxItem-->
  93. <Style TargetType="ComboBoxItem">
  94. <Setter Property="MinHeight" Value="22"></Setter>
  95. <Setter Property="MinWidth" Value="60"></Setter>
  96. <Setter Property="Template">
  97. <Setter.Value>
  98. <ControlTemplate TargetType="ComboBoxItem">
  99. <Border Name="Back" Background="{TemplateBinding Background}">
  100. <ContentPresenter ContentSource="{Binding Source}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10,0,0,0" ></ContentPresenter>
  101. </Border>
  102. </ControlTemplate>
  103. </Setter.Value>
  104. </Setter>
  105. </Style>
  106. </Setter.Value>
  107. </Setter>
  108. <Setter Property="Template">
  109. <Setter.Value>
  110. <ControlTemplate TargetType="ComboBox">
  111. <Grid>
  112. <Grid.ColumnDefinitions>
  113. <ColumnDefinition Width="0.7*"/>
  114. <ColumnDefinition Width="0.3*" MaxWidth="30"/>
  115. </Grid.ColumnDefinitions>
  116. <!--文字区域背景和边线样式-->
  117. <TextBox Background="{TemplateBinding Background}" VerticalAlignment="Center" Grid.Column="0" Foreground="{TemplateBinding Foreground}" BorderThickness="0" IsReadOnly="True" VerticalContentAlignment="Center" Text="{TemplateBinding Text}" Margin="0"></TextBox>
  118. <Border Grid.Column="0" BorderThickness="1" BorderBrush="Gray" CornerRadius="1,0,0,1">
  119. </Border>
  120. <!--右侧下拉button设置-->
  121. <Border Grid.Column="1" BorderThickness="0,1,1,1" BorderBrush="Gray" CornerRadius="0,1,1,0">
  122. <ToggleButton BorderThickness="3" BorderBrush="Gray" Style="{StaticResource ComboxStyleBtn}" IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"></ToggleButton>
  123. </Border>
  124. <!--弹出popup整体设置-->
  125. <Popup IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" x:Name="Popup" Focusable="False" AllowsTransparency="True" PopupAnimation="Slide" >
  126. <!--弹出popup边框-->
  127. <Border CornerRadius="1" BorderBrush="Gray" BorderThickness="1,0,1,1" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{TemplateBinding ActualWidth}" x:Name="DropDown" SnapsToDevicePixels="True">
  128. <Border.Effect>
  129. <DropShadowEffect Color="LightGray" BlurRadius="2" ShadowDepth="0" Opacity="1"/>
  130. </Border.Effect>
  131. <!--下拉幕布边界背景设置 MaxHeight="{TemplateBinding MaxDropDownHeight}"-->
  132. <ScrollViewer Margin="0,0,0,0" SnapsToDevicePixels="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" BorderBrush="Gray" BorderThickness="2" >
  133. <!-- StackPanel 用于显示子级,方法是将 IsItemsHost 设置为 True -->
  134. <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" Background="LightGray" />
  135. </ScrollViewer>
  136. </Border>
  137. </Popup>
  138. </Grid>
  139. </ControlTemplate>
  140. </Setter.Value>
  141. </Setter>
  142. </Style>
  143. </UserControl.Resources>
  144. <Grid x:Name="gridAll">
  145. <Grid.ColumnDefinitions>
  146. <ColumnDefinition Width="200" />
  147. <ColumnDefinition Width="*" />
  148. <ColumnDefinition Width="50" />
  149. <ColumnDefinition Width="150" />
  150. </Grid.ColumnDefinitions>
  151. <Image Grid.Row="0" Grid.Column="0" Width="200" Grid.RowSpan="2" Source="/Aitex.Sorter.UI;component/Resources/images/Yaskawa_logo.png" HorizontalAlignment="Left" Grid.ColumnSpan="2" Margin="10,-15,0,0"></Image>
  152. <StackPanel Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Orientation="Horizontal" Margin="20,80,0,0">
  153. <TextBlock Text="{DynamicResource GlobalLableVersion}" Foreground="white" Style="{StaticResource MainTextBlock}" FontSize="11" Padding="5,0" />
  154. <TextBlock Text="{Binding SoftwareVersion}" Foreground="white" Style="{StaticResource MainTextBlock}" FontSize="11" Padding="5,0" />
  155. </StackPanel>
  156. <Border Grid.Column="1" Background="#c1e2ff" BorderBrush="#0b77c2" CornerRadius="6" Margin="2" >
  157. <Grid VerticalAlignment="Stretch">
  158. <Grid.RowDefinitions>
  159. <RowDefinition Height="*" />
  160. <RowDefinition Height="*" />
  161. <RowDefinition Height="*" />
  162. </Grid.RowDefinitions>
  163. <Grid.ColumnDefinitions>
  164. <ColumnDefinition Width="*" />
  165. <ColumnDefinition Width="220" />
  166. </Grid.ColumnDefinitions>
  167. <TextBlock Grid.Row="0" Text ="System" Margin="5,0,0,0" Grid.Column="0" x:Name="txtTitle" FontSize="25" Foreground="#434668" Style="{StaticResource MainTextBlock}" />
  168. <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Margin="0" HorizontalAlignment="Center">
  169. <TextBlock Text="System:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Padding="0" Margin="5,0,0,0"/>
  170. <Border BorderThickness="1" BorderBrush="Gray" Margin="10,5" VerticalAlignment="Center" Background="{Binding SystemStatusBackground}" >
  171. <TextBlock VerticalAlignment="Center" Text="{Binding SystemStatus}" Style="{StaticResource TopPanelStatus}" Width="150" Margin="0,0,0,3" HorizontalAlignment="Center"/>
  172. </Border>
  173. <TextBlock Text="LoadPort:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Padding="0" Margin="5,0,0,0" />
  174. <Border BorderThickness="1" BorderBrush="Gray" Margin="5,5,2,5" VerticalAlignment="Center" HorizontalAlignment="Center" >
  175. <TextBlock Text="{Binding LoadPort1Status}" Background="{Binding LoadPort1StatusBackground}" Style="{StaticResource TopPanelStatus}" Width="90" VerticalAlignment="Center" Margin="0,0,0,3"/>
  176. </Border>
  177. <Border BorderThickness="1" BorderBrush="Gray" Margin="2,5,10,5" VerticalAlignment="Center">
  178. <TextBlock Text="{Binding LoadPort2Status}" Background="{Binding LoadPort2StatusBackground}" Style="{StaticResource TopPanelStatus}" Width="90" VerticalAlignment="Center" Margin="0,0,0,3"/>
  179. </Border>
  180. <TextBlock Text="Robot:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Padding="0" Margin="5,0,0,0" />
  181. <Border BorderThickness="1" BorderBrush="Gray" Margin="10,5" VerticalAlignment="Center">
  182. <TextBlock Text="{Binding RobotStatus}" Background="{Binding RobotStatusBackground}" Style="{StaticResource TopPanelStatus}" Width="90" VerticalAlignment="Center" Margin="0,0,0,3"/>
  183. </Border>
  184. <TextBlock Text="Aligner:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Padding="0" Margin="5,0,0,0" />
  185. <Border BorderThickness="1" BorderBrush="Gray" Margin="10,5" VerticalAlignment="Center">
  186. <TextBlock Text="{Binding AlignerStatus}" Background="{Binding AlignerStatusBackground}" Style="{StaticResource TopPanelStatus}" Width="90" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,0,3"/>
  187. </Border>
  188. <TextBlock Text="Host:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Padding="0" Margin="5,0,0,0" />
  189. <Border BorderThickness="1" BorderBrush="Gray" Margin="5,5,2,5" VerticalAlignment="Center">
  190. <TextBlock Text="{Binding HostCommunicationStatus}" Background="{Binding HostCommunicationStatusBackground}" Style="{StaticResource TopPanelStatus}" Width="150" VerticalAlignment="Center" Margin="0,0,0,3"/>
  191. </Border>
  192. <Border BorderThickness="1" BorderBrush="Gray" Margin="2,5,10,5" VerticalAlignment="Center">
  193. <TextBlock Text="{Binding HostControlStatus}" Background="{Binding HostControlStatusBackground}" Style="{StaticResource TopPanelStatus}" Width="150" VerticalAlignment="Center" Margin="0,0,0,3"/>
  194. </Border>
  195. </StackPanel>
  196. <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0">
  197. <Button Content="FA Enable" Height="30" Width="100" IsEnabled="{Binding IsFAEnableButtonEnabled}" Command="{Binding InvokeCommand}" CommandParameter="FACommand,FAEnable" />
  198. <Button Content="FA Disable" Height="30" Width="100" IsEnabled="{Binding IsFADisableButtonEnabled}" Command="{Binding InvokeCommand}" CommandParameter="FACommand,FADisable" />
  199. </StackPanel>
  200. <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0">
  201. <Button Content="Auto" Height="30" Width="100" Command="{Binding InvokeCommand}" CommandParameter="SetAutoMode" IsEnabled="{Binding IsAutoButtonEnabled}" />
  202. <Button Content="Manual" Height="30" Width="100" IsEnabled="{Binding IsManualButtonEnabled}" Command="{Binding InvokeCommand}" CommandParameter="SetManualMode" />
  203. </StackPanel>
  204. <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
  205. <TextBlock Text="Event:" Style="{StaticResource txtStatus}" VerticalAlignment="Center" Margin="5"></TextBlock>
  206. <ComboBox Width="1210" Style="{StaticResource ComboBoxStyle}" x:Name="comboEvent" DropDownClosed="comboEvent_DropDownClosed" Focusable="False" />
  207. </StackPanel>
  208. <StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Right">
  209. <Button VerticalAlignment="Center" Height="30" Width="100" Content="Reset" Click="btnReset_Click"/>
  210. <Button VerticalAlignment="Center" Height="30" Width="100" Content="Buzzer OFF" Command="{Binding SwitchOffBuzzerCommand}" />
  211. </StackPanel>
  212. </Grid>
  213. </Border>
  214. <Border Grid.Row="0" Grid.Column="2" Background="#c1e2ff" BorderBrush="#0b77c2" CornerRadius="6" Margin="8" Padding="4">
  215. <deviceControl:AITSignalTower Grid.Column="1" x:Name="signalTower" DeviceData="{Binding Path=SignalTower}" Width="30" Margin="-2,15,-2,-15" />
  216. </Border>
  217. <Grid Grid.Row="0" Grid.Column="3">
  218. <Grid.RowDefinitions>
  219. <RowDefinition Height="*" />
  220. <RowDefinition Height="*" />
  221. <RowDefinition Height="*" />
  222. </Grid.RowDefinitions>
  223. <Grid.ColumnDefinitions>
  224. <ColumnDefinition Width="*" />
  225. <ColumnDefinition Width="*" />
  226. </Grid.ColumnDefinitions>
  227. <TextBlock Grid.Column="0" Grid.Row="0" Text="{DynamicResource GlobalLableLogin}" Foreground="White" FontSize="15" Style="{StaticResource MainTextBlock}" Padding="5,0" />
  228. <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding User}" FontSize="15" Foreground="White" Style="{StaticResource MainTextBlock}" Padding="5,0" />
  229. <TextBlock Grid.Column="0" Grid.Row="1" Text="{DynamicResource GlobalLableRole}" Foreground="White" FontSize="15" Style="{StaticResource MainTextBlock}" Padding="5,0" />
  230. <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding Role}" FontSize="15" Foreground="White" Style="{StaticResource MainTextBlock}" Padding="5,0" />
  231. <Button Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Width="90" FontSize="15" Height="30" Padding="0" Margin="3,3" VerticalAlignment="Center" Content="{DynamicResource GlobalLableLogout}" Click="btnLogoff_Click" />
  232. </Grid>
  233. </Grid>
  234. </UserControl>