87 lines
2.5 KiB
C#
87 lines
2.5 KiB
C#
|
|
using CaeGlobals;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Runtime.CompilerServices;
|
|||
|
|
|
|||
|
|
namespace CaeKnowledge.View
|
|||
|
|
{
|
|||
|
|
public class ViewElasticWithDensity: INotifyPropertyChanged
|
|||
|
|
{
|
|||
|
|
private string _name;
|
|||
|
|
private string _displayName;
|
|||
|
|
private string _description;
|
|||
|
|
private double _youngsModulus;
|
|||
|
|
private double _poissonsRatio;
|
|||
|
|
private double _density;
|
|||
|
|
|
|||
|
|
[Category("1一般信息")]
|
|||
|
|
[OrderedDisplayName(0, 3, "材料名称")]
|
|||
|
|
public string Name
|
|||
|
|
{
|
|||
|
|
get => _name;
|
|||
|
|
set => SetField(ref _name, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("1一般信息")]
|
|||
|
|
[OrderedDisplayName(1, 3, "材料中文名")]
|
|||
|
|
public string DisplayName
|
|||
|
|
{
|
|||
|
|
get => _displayName;
|
|||
|
|
set => SetField(ref _displayName, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("1一般信息")]
|
|||
|
|
[OrderedDisplayName(2, 3, "描述")]
|
|||
|
|
public string Description
|
|||
|
|
{
|
|||
|
|
get => _description;
|
|||
|
|
set => SetField(ref _description, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("2材料属性")]
|
|||
|
|
[OrderedDisplayName(0, 3, "杨氏模量")]
|
|||
|
|
[Description("单位Gpa")]
|
|||
|
|
public double YoungsModulus
|
|||
|
|
{
|
|||
|
|
get => _youngsModulus;
|
|||
|
|
set => SetField(ref _youngsModulus, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("2材料属性")]
|
|||
|
|
[OrderedDisplayName(1, 3, "泊松比")]
|
|||
|
|
public double PoissonsRatio
|
|||
|
|
{
|
|||
|
|
get => _poissonsRatio;
|
|||
|
|
set => SetField(ref _poissonsRatio, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[Category("2材料属性")]
|
|||
|
|
[OrderedDisplayName(2, 3, "密度")]
|
|||
|
|
[Description("单位Kg/cm^3")]
|
|||
|
|
public double Density
|
|||
|
|
{
|
|||
|
|
get => _density;
|
|||
|
|
set => SetField(ref _density, value);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public bool IsValid()
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|||
|
|
|
|||
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|||
|
|
{
|
|||
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
|||
|
|
{
|
|||
|
|
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
|
|||
|
|
field = value;
|
|||
|
|
OnPropertyChanged(propertyName);
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|