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

58 lines
1.6 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.Windows;
namespace NavisworksTransport.UI.WPF.Views
{
/// <summary>
/// 吊装提升高度设置对话框
/// </summary>
public partial class AerialHeightDialog : Window
{
/// <summary>
/// 获取或设置提升高度(米)
/// </summary>
public double LiftHeightMeters { get; private set; }
/// <summary>
/// 构造函数
/// </summary>
public AerialHeightDialog()
{
InitializeComponent();
}
/// <summary>
/// 构造函数(带默认值)
/// </summary>
/// <param name="defaultHeight">默认高度(米)</param>
public AerialHeightDialog(double defaultHeight) : this()
{
HeightTextBox.Text = defaultHeight.ToString("F1");
}
/// <summary>
/// 确定按钮点击事件
/// </summary>
private void OnOKClick(object sender, RoutedEventArgs e)
{
if (double.TryParse(HeightTextBox.Text, out double height) && height > 0)
{
LiftHeightMeters = height;
DialogResult = true;
}
else
{
System.Windows.MessageBox.Show("请输入有效的提升高度大于0的数字", "错误",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
/// <summary>
/// 取消按钮点击事件
/// </summary>
private void OnCancelClick(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
}
}