fix: 碰撞热点分析对话框按钮语义修正(手动入口场景)
- 按钮'继续生成动画'→'重新生成动画'(手动分析入口不在动画生成流程中, 旧名误导);ToolTip 说明行为 - 按钮启用由勾选状态驱动:有默认预选或用户勾选的排除对象才激活 (IsExcluded PropertyChanged → UpdateActionButtonState) - 无排除选中时按钮禁用(用户点'取消'关闭);ActionButton_Click 防御 (无排除 → 等同取消,不再触发 Continue 保存记录) - Continue 分支保留(自动关闭场景使用) 验证:集成测试 25/25
This commit is contained in:
parent
85eb10a1b1
commit
6ef11b752a
@ -199,8 +199,11 @@
|
|||||||
|
|
||||||
<!-- 按钮 -->
|
<!-- 按钮 -->
|
||||||
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Grid.Row="5" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Content="继续生成动画"
|
<Button x:Name="ActionButton"
|
||||||
|
Content="重新生成动画"
|
||||||
Width="120"
|
Width="120"
|
||||||
|
IsEnabled="False"
|
||||||
|
ToolTip="将选中的物体加入排除列表并重新生成动画(排除后重新检测)"
|
||||||
Click="ActionButton_Click"
|
Click="ActionButton_Click"
|
||||||
Style="{StaticResource ActionButtonStyle}"/>
|
Style="{StaticResource ActionButtonStyle}"/>
|
||||||
<Button Content="取消"
|
<Button Content="取消"
|
||||||
|
|||||||
@ -60,13 +60,37 @@ namespace NavisworksTransport.UI.WPF.Views
|
|||||||
|
|
||||||
_viewModels = viewModels;
|
_viewModels = viewModels;
|
||||||
|
|
||||||
|
// 🔥 勾选状态驱动“重新生成动画”按钮启用(有任一选中才可执行)
|
||||||
|
foreach (var vm in viewModels)
|
||||||
|
{
|
||||||
|
vm.PropertyChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(HotspotViewModel.IsExcluded))
|
||||||
|
{
|
||||||
|
UpdateActionButtonState();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// 记录自动选中结果
|
// 记录自动选中结果
|
||||||
int autoSelectedCount = viewModels.Count(vm => vm.IsExcluded);
|
int autoSelectedCount = viewModels.Count(vm => vm.IsExcluded);
|
||||||
LogManager.Info($"[碰撞分析] 自动选中 {autoSelectedCount}/{viewModels.Count} 个高频碰撞物体(>100次或>50%)");
|
LogManager.Info($"[碰撞分析] 自动选中 {autoSelectedCount}/{viewModels.Count} 个高频碰撞物体(>100次或>50%)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateActionButtonState()
|
||||||
|
{
|
||||||
|
if (ActionButton != null)
|
||||||
|
{
|
||||||
|
bool hasExcluded = _viewModels?.Any(vm => vm.IsExcluded) ?? false;
|
||||||
|
ActionButton.IsEnabled = hasExcluded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CollisionAnalysisDialog_Loaded(object sender, RoutedEventArgs e)
|
private void CollisionAnalysisDialog_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
// 初始预选状态驱动按钮(有自动选中的排除对象 → 激活重新生成动画)
|
||||||
|
UpdateActionButtonState();
|
||||||
|
|
||||||
if (!TestAutomationHttpService.ShouldAutoConfirmCollisionAnalysisDialogs &&
|
if (!TestAutomationHttpService.ShouldAutoConfirmCollisionAnalysisDialogs &&
|
||||||
!AutomationModeContext.IsAutomaticMode)
|
!AutomationModeContext.IsAutomaticMode)
|
||||||
{
|
{
|
||||||
@ -185,8 +209,9 @@ namespace NavisworksTransport.UI.WPF.Views
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedAction = CollisionAnalysisAction.Continue;
|
// 🔥 防御:无选中排除时(按钮通常已禁用)——等同取消,不做任何业务操作
|
||||||
LogManager.Info("[碰撞分析] 用户选择直接继续生成(无排除对象)");
|
SelectedAction = CollisionAnalysisAction.Cancel;
|
||||||
|
LogManager.Info("[碰撞分析] 无排除对象选中,等同取消");
|
||||||
}
|
}
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user