NavisworksTransport/src/UI/WPF/Models/LogisticsModel.cs

72 lines
1.8 KiB
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Collections.Generic;
using Autodesk.Navisworks.Api;
namespace NavisworksTransport.UI.WPF.ViewModels
{
/// <summary>
/// 物流模型数据类
/// </summary>
public class LogisticsModel : INotifyPropertyChanged
{
private string _name;
private string _category;
private string _attributes;
private bool _isVisible;
/// <summary>
/// 模型名称
/// </summary>
public string Name
{
get => _name;
set => SetProperty(ref _name, value);
}
/// <summary>
/// 模型类别
/// </summary>
public string Category
{
get => _category;
set => SetProperty(ref _category, value);
}
/// <summary>
/// 模型属性
/// </summary>
public string Attributes
{
get => _attributes;
set => SetProperty(ref _attributes, value);
}
/// <summary>
/// 是否可见
/// </summary>
public bool IsVisible
{
get => _isVisible;
set => SetProperty(ref _isVisible, value);
}
/// <summary>
/// 关联的Navisworks模型项
/// </summary>
public ModelItem NavisworksItem { get; set; }
#region INotifyPropertyChanged实现
public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return;
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}