From 30d89b8ad7a83c808696935542b2458d7dafc49a Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Mon, 15 Sep 2025 01:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=98=BE=E7=A4=BA=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=A3=80=E6=B5=8B=E6=8A=A5=E5=91=8A=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/AnimationControlViewModel.cs | 34 ++----------------- src/UI/WPF/Views/AnimationControlView.xaml.cs | 5 ++- src/UI/WPF/Views/LogisticsControlPanel.xaml | 2 +- .../WPF/Views/LogisticsControlPanel.xaml.cs | 25 ++++++++------ 4 files changed, 19 insertions(+), 47 deletions(-) diff --git a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs index 6b75999..b44e4f6 100644 --- a/src/UI/WPF/ViewModels/AnimationControlViewModel.cs +++ b/src/UI/WPF/ViewModels/AnimationControlViewModel.cs @@ -407,39 +407,9 @@ namespace NavisworksTransport.UI.WPF.ViewModels #region 构造函数 - public AnimationControlViewModel() : base() + public AnimationControlViewModel() : this(null) { - try - { - // 初始化管理器 - _pathAnimationManager = new NavisworksTransport.Core.Animation.PathAnimationManager(); - _logisticsAnimationManager = new NavisworksTransport.Core.Animation.LogisticsAnimationManager(); - _clashIntegration = ClashDetectiveIntegration.Instance; - _uiStateManager = UIStateManager.Instance; - - // 订阅PathAnimationManager事件 - _pathAnimationManager.ProgressChanged += OnAnimationProgressChanged; - _pathAnimationManager.StateChanged += OnAnimationStateChanged; - - // 初始化集合 - AvailableFrameRates = new ThreadSafeObservableCollection(); - - // 初始化设置 - InitializeAnimationSettings(); - - // 初始化命令 - InitializeCommands(); - - // 移除重复的碰撞检测事件订阅,只在带参构造函数中保留 - // _clashIntegration.CollisionDetected += OnCollisionDetected; - - LogManager.Info("AnimationControlViewModel初始化完成(含缓存管理)"); - } - catch (Exception ex) - { - LogManager.Error($"AnimationControlViewModel初始化失败: {ex.Message}", ex); - throw; - } + // 调用带参数的构造函数,传入null } /// diff --git a/src/UI/WPF/Views/AnimationControlView.xaml.cs b/src/UI/WPF/Views/AnimationControlView.xaml.cs index 9a32bc5..1226dbb 100644 --- a/src/UI/WPF/Views/AnimationControlView.xaml.cs +++ b/src/UI/WPF/Views/AnimationControlView.xaml.cs @@ -16,10 +16,9 @@ namespace NavisworksTransport.UI.WPF.Views /// public AnimationControlViewModel ViewModel { get; private set; } - public AnimationControlView() + public AnimationControlView() : this(null) { - InitializeComponent(); - InitializeViewModel(); + // 调用带参数的构造函数,传入null } /// diff --git a/src/UI/WPF/Views/LogisticsControlPanel.xaml b/src/UI/WPF/Views/LogisticsControlPanel.xaml index 0351541..0644871 100644 --- a/src/UI/WPF/Views/LogisticsControlPanel.xaml +++ b/src/UI/WPF/Views/LogisticsControlPanel.xaml @@ -62,7 +62,7 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2 - + diff --git a/src/UI/WPF/Views/LogisticsControlPanel.xaml.cs b/src/UI/WPF/Views/LogisticsControlPanel.xaml.cs index 01c0254..ba235b7 100644 --- a/src/UI/WPF/Views/LogisticsControlPanel.xaml.cs +++ b/src/UI/WPF/Views/LogisticsControlPanel.xaml.cs @@ -23,6 +23,9 @@ namespace NavisworksTransport.UI.WPF // 类别设置视图 private ModelSettingsView _modelSettingsView; + // 动画控制视图 + public AnimationControlView AnimationControlView { get; private set; } + // 管理器实例 private PathPlanningManager _pathPlanningManager; private static bool _isSessionInitialized = false; @@ -155,23 +158,23 @@ namespace NavisworksTransport.UI.WPF { try { - // 重新创建AnimationControlView,传入主ViewModel引用 + // 创建AnimationControlView,传入主ViewModel引用 var newAnimationControlView = new AnimationControlView(ViewModel); - - // 替换XAML中的AnimationControlView - if (AnimationControlTab?.Content is Border animationControlBorder) + + // 设置到ContentControl中 + if (AnimationControlContent != null) { - animationControlBorder.Child = newAnimationControlView; - + AnimationControlContent.Content = newAnimationControlView; + // 更新引用 AnimationControlView = newAnimationControlView; - } - - if (AnimationControlView?.ViewModel != null) - { - // 动画控制视图现在通过PathEditingView获取路径信息 + LogManager.Info("AnimationControlView初始化完成 - 支持统一状态栏"); } + else + { + LogManager.Error("AnimationControlContent占位符未找到"); + } } catch (Exception ex) {