增加射线源探测器Z轴锁定联动功能,增加对应plc信号和配置。

This commit is contained in:
QI Mingxuan
2026-05-07 20:24:55 +08:00
parent 5e14fe3d9b
commit bb1b76ee7a
17 changed files with 404 additions and 114 deletions
+19 -11
View File
@@ -4,6 +4,7 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using XP.Common.Logging.Interfaces;
namespace XP.Common.Controls
{
@@ -31,13 +32,13 @@ namespace XP.Common.Controls
/// <summary>操控点元素引用 | Thumb element reference</summary>
private Ellipse? _thumbElement;
#endregion
#endregion
#region | Constructor
#region | Constructor
public VirtualJoystick()
public VirtualJoystick()
{
InitializeComponent();
InitializeComponent();
// 控件加载完成后绑定操控点的 TranslateTransform | Bind thumb TranslateTransform after control loaded
Loaded += (s, e) =>
@@ -46,8 +47,8 @@ namespace XP.Common.Controls
if (_thumbElement != null)
_thumbElement.RenderTransform = _thumbTransform;
// 初始化时更新背景和图标可见性 | Update background and icon visibility on init
UpdateIconVisibility();
// 初始化时更新背景和图标可见性 | Update background and icon visibility on init
UpdateIconVisibility();
};
}
@@ -152,7 +153,10 @@ namespace XP.Common.Controls
private static void OnSwapMouseButtonsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is VirtualJoystick joystick)
{
joystick.ActiveMouseButton = MouseButtonType.None;
joystick.UpdateIconVisibility();
}
}
#endregion
@@ -363,19 +367,23 @@ namespace XP.Common.Controls
case MouseButtonType.Left:
SetVisibility(Visibility.Collapsed, defaultTop, defaultBottom, defaultLeft, defaultRight);
// 如果交换了左右键,这里显示的是右键图标组
var leftIcons = SwapMouseButtons ? new[] { rightTop, rightBottom, rightLeft, rightRight } : new[] { leftTop, leftBottom, leftLeft, leftRight };
var leftIcons = new[] { leftTop, leftBottom, leftLeft, leftRight };
SetVisibility(Visibility.Visible, leftIcons);
if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x3A, 0x7B, 0xC8));
if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x2D, 0x63, 0x9E)); // 深一点的浅蓝色 | Darker light blue
break;
case MouseButtonType.Right:
SetVisibility(Visibility.Collapsed, defaultTop, defaultBottom, defaultLeft, defaultRight);
// 如果交换了左右键,这里显示的是左键图标组
var rightIcons = SwapMouseButtons ? new[] { leftTop, leftBottom, leftLeft, leftRight } : new[] { rightTop, rightBottom, rightLeft, rightRight };
var rightIcons = new[] { rightTop, rightBottom, rightLeft, rightRight };
SetVisibility(Visibility.Visible, rightIcons);
if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x5B, 0xA8, 0x5B));
if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x45, 0x88, 0x45)); // 深一点的浅绿色 | Darker light green
break;
default:
if (_thumbElement != null) _thumbElement.Fill = new SolidColorBrush(Color.FromRgb(0x4A, 0x90, 0xD9));
// 根据 SwapMouseButtons 决定中心按钮颜色 | Determine center button color based on SwapMouseButtons
if (_thumbElement != null)
_thumbElement.Fill = SwapMouseButtons
? new SolidColorBrush(Color.FromRgb(0x5B, 0xA8, 0x5B)) // 浅绿色 | Light green
: new SolidColorBrush(Color.FromRgb(0x4A, 0x90, 0xD9)); // 浅蓝色 | Light blue
break;
}