DefaultRobotDebugPage.xaml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <UserControl x:Class="TeamAAS.Robot.UI.DefaultRobotDebugPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:loc="clr-namespace:TeamAAS.Localization;assembly=TeamAAS.Global">
  5. <UserControl.Resources>
  6. <!-- Jog 按钮样式(从主程序 SettingView 局部资源复制,库页独立自带) -->
  7. <Style x:Key="JogButton" TargetType="Button">
  8. <Setter Property="FontSize" Value="18"/>
  9. <Setter Property="FontWeight" Value="Bold"/>
  10. <Setter Property="Margin" Value="4"/>
  11. <Setter Property="Padding" Value="0,14"/>
  12. <Setter Property="MinHeight" Value="48"/>
  13. <Setter Property="Cursor" Value="Hand"/>
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate TargetType="Button">
  17. <Border x:Name="bd" Background="{DynamicResource SecondaryRegionBrush}"
  18. CornerRadius="4" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
  19. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  20. </Border>
  21. <ControlTemplate.Triggers>
  22. <Trigger Property="IsMouseOver" Value="True">
  23. <Setter TargetName="bd" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
  24. <Setter Property="Foreground" Value="White"/>
  25. </Trigger>
  26. <Trigger Property="IsPressed" Value="True">
  27. <Setter TargetName="bd" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
  28. <Setter Property="Foreground" Value="White"/>
  29. </Trigger>
  30. <Trigger Property="IsEnabled" Value="False">
  31. <Setter TargetName="bd" Property="Opacity" Value="0.4"/>
  32. </Trigger>
  33. </ControlTemplate.Triggers>
  34. </ControlTemplate>
  35. </Setter.Value>
  36. </Setter>
  37. </Style>
  38. </UserControl.Resources>
  39. <Border Background="{DynamicResource RegionBrush}" CornerRadius="8">
  40. <DockPanel Margin="8">
  41. <TextBlock DockPanel.Dock="Top" Text="{loc:Translate '手动调试'}" FontSize="14" FontWeight="Bold"
  42. Margin="8,4,0,8" Foreground="{DynamicResource PrimaryTextBrush}"/>
  43. <!-- 状态栏 -->
  44. <Border DockPanel.Dock="Top" Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="4" Padding="12,6" Margin="4,0,4,8">
  45. <StackPanel Orientation="Horizontal">
  46. <TextBlock Text="{loc:Translate '状态: '}" FontSize="12" Foreground="{DynamicResource SecondaryTextBrush}"/>
  47. <TextBlock x:Name="TxtStatus" FontSize="12" FontWeight="Bold" Foreground="{DynamicResource PrimaryBrush}"/>
  48. <TextBlock Text=" | " FontSize="12" Foreground="{DynamicResource SecondaryTextBrush}"/>
  49. <TextBlock x:Name="TxtMessage" FontSize="12" Foreground="{DynamicResource SecondaryTextBrush}"/>
  50. </StackPanel>
  51. </Border>
  52. <!-- 坐标显示 -->
  53. <Border DockPanel.Dock="Top" Background="#1E1E1E" CornerRadius="4" Padding="16,10" Margin="4,0,4,8">
  54. <StackPanel>
  55. <TextBlock Text="{loc:Translate '当前坐标'}" FontSize="11" Foreground="#888888" Margin="0,0,0,4"/>
  56. <TextBlock x:Name="TxtPos" Text="X: --- Y: --- Z: ---" FontSize="13" FontFamily="Consolas" Foreground="#4FC3F7"/>
  57. </StackPanel>
  58. </Border>
  59. <!-- 操作区(未绑定机器人时整体禁用) -->
  60. <StackPanel x:Name="OpsRoot" DockPanel.Dock="Top" IsEnabled="False">
  61. <WrapPanel Orientation="Horizontal" Margin="4,0,4,8">
  62. <Button x:Name="BtnMotorOn" Content="{loc:Translate '电机开'}" Click="BtnMotorOn_Click" Padding="12,4" Margin="0,0,6,6"/>
  63. <Button x:Name="BtnMotorOff" Content="{loc:Translate '电机关'}" Click="BtnMotorOff_Click" Padding="12,4" Margin="0,0,6,6"/>
  64. <Button x:Name="BtnReset" Content="{loc:Translate '重置'}" Click="BtnReset_Click" Padding="12,4" Margin="0,0,6,6"/>
  65. <Button x:Name="BtnSFree" Content="{loc:Translate '释放刹车'}" Click="BtnSFree_Click" Padding="12,4" Margin="0,0,6,6"/>
  66. <Button x:Name="BtnSLock" Content="{loc:Translate '锁定刹车'}" Click="BtnSLock_Click" Padding="12,4" Margin="0,0,6,6"/>
  67. <Button x:Name="BtnGetPos" Content="{loc:Translate '读坐标'}" Click="BtnGetPos_Click" Padding="12,4" Margin="0,0,6,6"/>
  68. </WrapPanel>
  69. <Grid Margin="4,0,4,8">
  70. <Grid.ColumnDefinitions>
  71. <ColumnDefinition Width="*"/>
  72. <ColumnDefinition Width="*"/>
  73. </Grid.ColumnDefinitions>
  74. <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
  75. <TextBlock Text="{loc:Translate '步进:'}" FontSize="12" VerticalAlignment="Center" Margin="0,0,6,0"/>
  76. <TextBox x:Name="TxtStep" Text="1.0" Width="80" FontSize="12" VerticalContentAlignment="Center"/>
  77. <TextBlock Text="mm" FontSize="12" VerticalAlignment="Center" Margin="4,0,0,0"/>
  78. </StackPanel>
  79. <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
  80. <TextBlock Text="Tool:" FontSize="12" VerticalAlignment="Center" Margin="0,0,6,0"/>
  81. <ComboBox x:Name="ToolCombo" SelectedIndex="0" Width="60" FontSize="12">
  82. <ComboBoxItem Content="0"/><ComboBoxItem Content="1"/><ComboBoxItem Content="2"/><ComboBoxItem Content="3"/>
  83. <ComboBoxItem Content="4"/><ComboBoxItem Content="5"/><ComboBoxItem Content="6"/><ComboBoxItem Content="7"/>
  84. <ComboBoxItem Content="8"/><ComboBoxItem Content="9"/><ComboBoxItem Content="10"/><ComboBoxItem Content="11"/>
  85. <ComboBoxItem Content="12"/><ComboBoxItem Content="13"/><ComboBoxItem Content="14"/><ComboBoxItem Content="15"/>
  86. </ComboBox>
  87. <Button x:Name="BtnSelectTool" Content="{loc:Translate '选择'}" Click="BtnSelectTool_Click" FontSize="11" Padding="8,2" Margin="6,0,0,0"/>
  88. </StackPanel>
  89. </Grid>
  90. <Border Background="{DynamicResource SecondaryRegionBrush}" CornerRadius="4" Padding="16" Margin="4,0,4,8">
  91. <StackPanel>
  92. <TextBlock Text="{loc:Translate '空间轴 (X / Y / Z)'}" FontSize="11" Foreground="{DynamicResource SecondaryTextBrush}" Margin="0,0,0,8" HorizontalAlignment="Center"/>
  93. <Grid Margin="0,0,0,12">
  94. <Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions>
  95. <Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
  96. <Button Grid.Row="0" Grid.Column="0" Content="X+" Tag="X+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  97. <Button Grid.Row="0" Grid.Column="1" Content="Y+" Tag="Y+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  98. <Button Grid.Row="0" Grid.Column="2" Content="Z+" Tag="Z+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  99. <Button Grid.Row="1" Grid.Column="0" Content="X-" Tag="X-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  100. <Button Grid.Row="1" Grid.Column="1" Content="Y-" Tag="Y-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  101. <Button Grid.Row="1" Grid.Column="2" Content="Z-" Tag="Z-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  102. </Grid>
  103. <Border Height="1" Background="{DynamicResource BorderBrush}" Margin="0,0,0,12"/>
  104. <TextBlock Text="{loc:Translate '旋转轴 (U / V / W)'}" FontSize="11" Foreground="{DynamicResource SecondaryTextBrush}" Margin="0,0,0,8" HorizontalAlignment="Center"/>
  105. <Grid>
  106. <Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="Auto"/></Grid.RowDefinitions>
  107. <Grid.ColumnDefinitions><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
  108. <Button Grid.Row="0" Grid.Column="0" Content="U+" Tag="U+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  109. <Button Grid.Row="0" Grid.Column="1" Content="V+" Tag="V+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  110. <Button Grid.Row="0" Grid.Column="2" Content="W+" Tag="W+" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  111. <Button Grid.Row="1" Grid.Column="0" Content="U-" Tag="U-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  112. <Button Grid.Row="1" Grid.Column="1" Content="V-" Tag="V-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  113. <Button Grid.Row="1" Grid.Column="2" Content="W-" Tag="W-" Style="{StaticResource JogButton}" Click="BtnJog_Click"/>
  114. </Grid>
  115. </StackPanel>
  116. </Border>
  117. </StackPanel>
  118. </DockPanel>
  119. </Border>
  120. </UserControl>