89 lines
2.8 KiB
C#
89 lines
2.8 KiB
C#
using System;
|
||
using System.Windows;
|
||
using System.Windows.Controls;
|
||
using NavisworksTransport.UI.WPF.ViewModels;
|
||
|
||
namespace NavisworksTransport.UI.WPF.Views
|
||
{
|
||
/// <summary>
|
||
/// PathAnalysisDialog.xaml 的交互逻辑
|
||
/// 路径规划分析对话框 - 用于多路径对比分析和最佳路径推荐
|
||
/// </summary>
|
||
public partial class PathAnalysisDialog : Window
|
||
{
|
||
/// <summary>
|
||
/// 初始化路径分析对话框
|
||
/// </summary>
|
||
public PathAnalysisDialog()
|
||
{
|
||
try
|
||
{
|
||
InitializeComponent();
|
||
|
||
// 绑定ViewModel
|
||
DataContext = new ViewModels.PathAnalysisViewModel();
|
||
|
||
LogManager.Info("PathAnalysisDialog初始化完成,已绑定PathAnalysisViewModel");
|
||
|
||
// 设置窗口标题包含当前时间
|
||
Title = $"路径规划分析 - 多路径对比 [{DateTime.Now:MM-dd HH:mm}]";
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogManager.Error($"初始化PathAnalysisDialog失败: {ex.Message}", ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 分析策略 RadioButton 选中事件
|
||
/// </summary>
|
||
private void StrategyRadioButton_Checked(object sender, RoutedEventArgs e)
|
||
{
|
||
if (sender is RadioButton rb && rb.Tag is string strategy)
|
||
{
|
||
if (DataContext is PathAnalysisViewModel viewModel)
|
||
{
|
||
viewModel.AnalysisStrategy = strategy;
|
||
LogManager.Info($"用户切换分析策略: {strategy}");
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <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);
|
||
}
|
||
}
|
||
}
|
||
} |