diff --git a/doc/requirement/todo_features.md b/doc/requirement/todo_features.md
index c669a20..e6a0d89 100644
--- a/doc/requirement/todo_features.md
+++ b/doc/requirement/todo_features.md
@@ -2,9 +2,17 @@
## 功能点
+### [2025/09/07]
+
+1. [ ] (功能)增加插件系统参数配置和管理
+2. [ ] (功能)增加物流属性自定义
+3. [x] (功能)增加底部状态栏,统一提示消息和进度条显示
+
### [2025/09/05]
1. [x] (功能)把三维视图选点光标改成十字形,当失去焦点时,按空格键切换回来。
+2. [x] (优化和功能) 用精确几何方式进行通道网格构建,用网格可视化方式确认其正确性
+3. [x] (优化) 重写路径优化算法,确保直线和直角转弯,不引入错误路径
### [2025/09/04]
diff --git a/src/UI/WPF/LogisticsControlPanel.xaml b/src/UI/WPF/LogisticsControlPanel.xaml
index 7a697eb..c5078e6 100644
--- a/src/UI/WPF/LogisticsControlPanel.xaml
+++ b/src/UI/WPF/LogisticsControlPanel.xaml
@@ -16,7 +16,7 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:views="clr-namespace:NavisworksTransport.UI.WPF.Views"
- mc:Ignorable="d"
+ mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="480">
@@ -25,6 +25,9 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2
+
+
+
@@ -78,17 +81,37 @@ NavisworksTransport 主控制面板 - 采用与其他视图一致的Navisworks 2
Background="#FFF8FBFF"
Margin="10,5,10,10"
Padding="12,8">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/UI/WPF/LogisticsControlPanel.xaml.cs b/src/UI/WPF/LogisticsControlPanel.xaml.cs
index 3c2bd56..4c6735e 100644
--- a/src/UI/WPF/LogisticsControlPanel.xaml.cs
+++ b/src/UI/WPF/LogisticsControlPanel.xaml.cs
@@ -61,8 +61,8 @@ namespace NavisworksTransport.UI.WPF
// 将分层管理视图添加到主界面
LayerManagementContent.Content = _layerManagementView;
- // 创建类别设置视图
- _modelSettingsView = new ModelSettingsView();
+ // 创建类别设置视图,传入主ViewModel引用以启用统一状态栏
+ _modelSettingsView = new ModelSettingsView(ViewModel);
// 将类别设置视图添加到主界面
ModelSettingsContent.Content = _modelSettingsView;
diff --git a/src/UI/WPF/ViewModels/LogisticsControlViewModel.cs b/src/UI/WPF/ViewModels/LogisticsControlViewModel.cs
index b24d236..90d88d0 100644
--- a/src/UI/WPF/ViewModels/LogisticsControlViewModel.cs
+++ b/src/UI/WPF/ViewModels/LogisticsControlViewModel.cs
@@ -38,6 +38,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
private bool _isLogisticsOnlyMode = false;
+ private bool _isProcessing = false;
// UI状态管理和命令框架
private readonly UIStateManager _uiStateManager;
@@ -192,6 +193,15 @@ namespace NavisworksTransport.UI.WPF.ViewModels
}
}
+ ///
+ /// 是否正在处理中(用于统一状态栏进度条显示)
+ ///
+ public bool IsProcessing
+ {
+ get => _isProcessing;
+ set => SetProperty(ref _isProcessing, value);
+ }
+
#region 动画控制属性
///
@@ -964,6 +974,53 @@ namespace NavisworksTransport.UI.WPF.ViewModels
#endregion
+ #region 统一状态栏方法
+
+ ///
+ /// 更新统一状态栏信息(简单版本,不显示进度条)
+ ///
+ /// 状态消息
+ public void UpdateStatus(string message)
+ {
+ SafeExecute(() =>
+ {
+ StatusText = message ?? "就绪";
+ IsProcessing = false; // 简单状态更新不显示进度条
+ }, "更新统一状态栏", runOnUIThread: true);
+ }
+
+ ///
+ /// 更新统一状态栏信息(完整版本)
+ ///
+ /// 状态消息
+ /// 进度值 (0-100),默认不显示进度条
+ /// 是否正在处理中(显示进度条动画)
+ public void UpdateStatus(string message, double progress = -1, bool? isProcessing = null)
+ {
+ SafeExecute(() =>
+ {
+ StatusText = message ?? "就绪";
+ if (progress >= 0)
+ {
+ AnimationProgress = Math.Max(0, Math.Min(100, progress));
+ }
+ if (isProcessing.HasValue)
+ {
+ IsProcessing = isProcessing.Value;
+ }
+ }, "更新统一状态栏", runOnUIThread: true);
+ }
+
+ ///
+ /// 重置状态栏到默认状态
+ ///
+ public void ResetStatus()
+ {
+ UpdateStatus("插件已就绪");
+ }
+
+ #endregion
+
#region 辅助方法
///
diff --git a/src/UI/WPF/ViewModels/ModelSettingsViewModel.cs b/src/UI/WPF/ViewModels/ModelSettingsViewModel.cs
index b3d83ac..756f3fa 100644
--- a/src/UI/WPF/ViewModels/ModelSettingsViewModel.cs
+++ b/src/UI/WPF/ViewModels/ModelSettingsViewModel.cs
@@ -32,6 +32,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
#region 私有字段和依赖注入
private readonly UIStateManager _uiStateManager;
+ private readonly LogisticsControlViewModel _mainViewModel;
// 选择事件订阅管理器
private SelectionEventSubscription _selectionEventSubscription;
@@ -45,7 +46,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
private bool _isProcessing;
private string _selectedModelsText = "请在主界面中选择需要设置的模型";
- private string _statusText = "就绪";
private string _selectedCategory = "通道";
private bool _isTraversable = true;
private int _priority = 5;
@@ -90,14 +90,6 @@ namespace NavisworksTransport.UI.WPF.ViewModels
set => SetPropertyThreadSafe(ref _selectedModelsText, value);
}
- ///
- /// 状态文本
- ///
- public string StatusText
- {
- get => _statusText;
- set => SetPropertyThreadSafe(ref _statusText, value);
- }
///
/// 可用类别集合 - 使用线程安全集合
@@ -281,12 +273,13 @@ namespace NavisworksTransport.UI.WPF.ViewModels
#region 构造函数 - 使用依赖注入和统一架构
- public ModelSettingsViewModel() : base()
+ public ModelSettingsViewModel(LogisticsControlViewModel mainViewModel = null) : base()
{
try
{
- // 获取UI状态管理器实例
+ // 获取UI状态管理器实例和主ViewModel引用
_uiStateManager = UIStateManager.Instance;
+ _mainViewModel = mainViewModel;
// 验证关键组件是否正常初始化
if (_uiStateManager == null)
@@ -310,7 +303,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
{
LogManager.Error($"ModelSettingsViewModel构造函数异常: {ex.Message}", ex);
- StatusText = "初始化失败,请检查日志";
+ UpdateMainStatus("初始化失败,请检查日志");
throw;
}
}
@@ -363,7 +356,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
IsProcessing = true;
- StatusText = "正在检查模型选择...";
+ UpdateMainStatus("正在检查模型选择...", -1, true);
});
try
@@ -377,12 +370,12 @@ namespace NavisworksTransport.UI.WPF.ViewModels
if (selectionResult.Success)
{
SelectedModelsText = NavisworksSelectionHelper.FormatSelectionText(selectionResult, "个模型");
- StatusText = "检查完成";
+ UpdateMainStatus("检查完成");
}
else
{
SelectedModelsText = selectionResult.ErrorMessage ?? "检查选择状态失败";
- StatusText = "检查失败";
+ UpdateMainStatus("检查失败");
}
// 🔧 修复:刷新所有与选择相关的命令状态(包括清除属性按钮)
@@ -400,7 +393,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
SelectedModelsText = "检查选择状态异常";
- StatusText = $"检查失败: {ex.Message}";
+ UpdateMainStatus($"检查失败: {ex.Message}");
});
}
finally
@@ -422,9 +415,10 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
IsProcessing = true;
- StatusText = "正在设置物流属性...";
+ UpdateMainStatus("正在设置物流属性...", -1, true);
});
+
try
{
// 2. 纯业务逻辑执行(后台线程,不使用UIStateManager)
@@ -473,7 +467,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 3. 结果UI更新
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
- StatusText = result.Message;
+ UpdateMainStatus(result.Message);
if (result.Success)
{
@@ -484,6 +478,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
LogManager.Warning($"设置物流属性失败: {result.Message}");
}
});
+
// 如果设置成功,异步刷新物流模型列表
if (result.Success)
@@ -507,8 +502,9 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 异常UI更新
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
- StatusText = $"设置属性出错: {ex.Message}";
+ UpdateMainStatus($"设置属性出错: {ex.Message}");
});
+
}
finally
{
@@ -517,6 +513,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
{
IsProcessing = false;
});
+
}
}
@@ -529,7 +526,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
IsProcessing = true;
- StatusText = "正在清除物流属性...";
+ UpdateMainStatus("正在清除物流属性...", -1, true);
});
try
@@ -565,7 +562,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 3. 结果UI更新
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
- StatusText = result.Message;
+ UpdateMainStatus(result.Message);
if (result.Success)
{
@@ -599,7 +596,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
// 异常UI更新
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
- StatusText = $"清除属性出错: {ex.Message}";
+ UpdateMainStatus($"清除属性出错: {ex.Message}");
});
}
finally
@@ -621,7 +618,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
IsProcessing = true;
- StatusText = "正在刷新物流模型列表...";
+ UpdateMainStatus("正在刷新物流模型列表...", -1, true);
});
try
@@ -670,11 +667,11 @@ namespace NavisworksTransport.UI.WPF.ViewModels
{
LogisticsModels.Add(model);
}
- StatusText = $"已刷新物流模型列表,共 {result.Count} 个模型";
+ UpdateMainStatus($"已刷新物流模型列表,共 {result.Count} 个模型");
}
else
{
- StatusText = "刷新物流模型列表失败";
+ UpdateMainStatus("刷新物流模型列表失败");
}
});
@@ -688,7 +685,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
LogisticsModels.Clear();
- StatusText = $"刷新列表出错: {ex.Message}";
+ UpdateMainStatus($"刷新列表出错: {ex.Message}");
});
}
finally
@@ -715,7 +712,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
HeightLimit = 3.0;
SpeedLimit = 0.8;
- StatusText = "已重置为默认值";
+ UpdateMainStatus("已重置为默认值");
LogManager.Info("已重置类别设置为默认值");
});
}
@@ -867,7 +864,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
RefreshAllCommands();
- StatusText = "分层属性设置已就绪";
+ UpdateMainStatus("分层属性设置已就绪");
});
}
catch (Exception ex)
@@ -875,7 +872,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
LogManager.Error($"[ModelSettingsViewModel] 初始化失败: {ex.Message}");
await _uiStateManager.ExecuteUIUpdateAsync(() =>
{
- StatusText = "初始化失败,请检查日志";
+ UpdateMainStatus("初始化失败,请检查日志");
});
}
}
@@ -912,12 +909,12 @@ namespace NavisworksTransport.UI.WPF.ViewModels
model.IsVisible = true;
}
- StatusText = "显示所有元素";
+ UpdateMainStatus("显示所有元素");
LogManager.Info("切换到显示全部模式");
}
else
{
- StatusText = $"显示全部失败: {result.Message}";
+ UpdateMainStatus($"显示全部失败: {result.Message}");
LogManager.Error($"显示全部失败: {result.Message}");
}
}
@@ -972,7 +969,7 @@ namespace NavisworksTransport.UI.WPF.ViewModels
}
var totalVisibleItems = itemsToKeepVisible.Count;
- StatusText = $"仅显示物流元素 ({logisticsItems.Count} 个物流节点,{totalVisibleItems} 个可见元素)";
+ UpdateMainStatus($"仅显示物流元素 ({logisticsItems.Count} 个物流节点,{totalVisibleItems} 个可见元素)");
LogManager.Info($"切换到仅显示物流模式: 找到 {logisticsItems.Count} 个物流节点,{totalVisibleItems} 个可见元素");
}
}
@@ -1219,6 +1216,44 @@ namespace NavisworksTransport.UI.WPF.ViewModels
System.Windows.Input.CommandManager.InvalidateRequerySuggested();
}
+ ///
+ /// 更新统一状态栏(简单版本,不显示进度条)
+ ///
+ private void UpdateMainStatus(string message)
+ {
+ try
+ {
+ // 如果有主ViewModel引用,更新统一状态栏
+ if (_mainViewModel != null)
+ {
+ _mainViewModel.UpdateStatus(message);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Error($"更新统一状态栏失败: {ex.Message}", ex);
+ }
+ }
+
+ ///
+ /// 更新统一状态栏(完整版本,支持进度条)
+ ///
+ private void UpdateMainStatus(string message, double progress = -1, bool? isProcessing = null)
+ {
+ try
+ {
+ // 如果有主ViewModel引用,更新统一状态栏
+ if (_mainViewModel != null)
+ {
+ _mainViewModel.UpdateStatus(message, progress, isProcessing);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Error($"更新统一状态栏失败: {ex.Message}", ex);
+ }
+ }
+
#endregion
#region 向后兼容性接口
diff --git a/src/UI/WPF/Views/ModelSettingsView.xaml b/src/UI/WPF/Views/ModelSettingsView.xaml
index 4819c0b..76030fd 100644
--- a/src/UI/WPF/Views/ModelSettingsView.xaml
+++ b/src/UI/WPF/Views/ModelSettingsView.xaml
@@ -259,29 +259,6 @@ NavisworksTransport 类别设置页签视图 - 参考分层管理页签的设计
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/UI/WPF/Views/ModelSettingsView.xaml.cs b/src/UI/WPF/Views/ModelSettingsView.xaml.cs
index f9caebc..f29a392 100644
--- a/src/UI/WPF/Views/ModelSettingsView.xaml.cs
+++ b/src/UI/WPF/Views/ModelSettingsView.xaml.cs
@@ -10,14 +10,14 @@ namespace NavisworksTransport.UI.WPF.Views
///
public partial class ModelSettingsView : UserControl
{
- public ModelSettingsView()
+ public ModelSettingsView(LogisticsControlViewModel mainViewModel = null)
{
InitializeComponent();
try
{
- // 设置数据上下文为新的ViewModel
- DataContext = new ModelSettingsViewModel();
+ // 设置数据上下文为新的ViewModel,传入主ViewModel引用
+ DataContext = new ModelSettingsViewModel(mainViewModel);
LogManager.Info("ModelSettingsView已初始化,使用新的ModelSettingsViewModel");
}
catch (System.Exception ex)