NavisworksTransport/src/UI/WPF/Views/PathAnalysisDialog.xaml.cs

91 lines
2.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Windows;
using NavisworksTransport.Utils;
namespace NavisworksTransport.UI.WPF.Views
{
/// <summary>
/// PathAnalysisDialog.xaml 的交互逻辑
/// 路径规划分析对话框 - 用于多路径对比分析和最佳路径推荐
/// </summary>
public partial class PathAnalysisDialog : Window
{
/// <summary>
/// 初始化路径分析对话框
/// </summary>
public PathAnalysisDialog()
{
try
{
InitializeComponent();
LogManager.Info("PathAnalysisDialog初始化完成");
// 设置窗口标题包含当前时间
Title = $"路径规划分析 - 多路径对比 [{DateTime.Now:MM-dd HH:mm}]";
// 加载演示数据(后续可以替换为实际数据绑定)
LoadDemoData();
}
catch (Exception ex)
{
LogManager.Error($"初始化PathAnalysisDialog失败: {ex.Message}", ex);
}
}
/// <summary>
/// 加载演示数据到UI控件
/// 这里提供静态演示数据实际使用时应该绑定到ViewModel
/// </summary>
private void LoadDemoData()
{
try
{
// 这里可以设置一些初始化的演示数据
// 目前UI已经包含了静态的演示数据后续可以通过DataContext绑定动态数据
LogManager.Info("路径分析演示数据加载完成");
}
catch (Exception ex)
{
LogManager.Error($"加载路径分析演示数据失败: {ex.Message}", ex);
}
}
/// <summary>
/// 关闭按钮点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CloseButton_Click(object sender, RoutedEventArgs e)
{
try
{
LogManager.Info("用户关闭路径分析对话框");
this.Close();
}
catch (Exception ex)
{
LogManager.Error($"关闭PathAnalysisDialog时发生错误: {ex.Message}", ex);
}
}
/// <summary>
/// 窗口关闭时的清理工作
/// </summary>
/// <param name="e"></param>
protected override void OnClosed(EventArgs e)
{
try
{
// 执行清理工作(如果需要)
LogManager.Info("PathAnalysisDialog已关闭执行清理");
base.OnClosed(e);
}
catch (Exception ex)
{
LogManager.Error($"PathAnalysisDialog清理过程中发生错误: {ex.Message}", ex);
}
}
}
}