77 lines
2.9 KiB
C#
77 lines
2.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.ComponentModel;
|
|
using DynamicTypeDescriptor;
|
|
using CaeGlobals;
|
|
using System.Drawing.Design;
|
|
|
|
namespace CPSO
|
|
{
|
|
[Serializable]
|
|
public abstract class ViewDefinedField : ViewMultiRegion
|
|
{
|
|
// Variables
|
|
private string _selectionHidden;
|
|
|
|
|
|
// Properties
|
|
[Category("Data")]
|
|
[OrderedDisplayName(0, 10, "Name")]
|
|
[Description("Name of the defined field.")]
|
|
[Id(1, 1)]
|
|
public abstract string Name { get; set; }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(0, 10, "Region type")]
|
|
[Description("Select the region type for the creation of the defined field.")]
|
|
[Id(1, 2)]
|
|
public override string RegionType { get { return base.RegionType; } set { base.RegionType = value; } }
|
|
//
|
|
[Category("Region")]
|
|
[OrderedDisplayName(1, 10, "Hidden")]
|
|
[Description("Hidden.")]
|
|
[Id(2, 2)]
|
|
public string SelectionHidden { get { return _selectionHidden; } set { _selectionHidden = value; } }
|
|
//
|
|
[Category("Time/Frequency")]
|
|
[OrderedDisplayName(0, 10, "Amplitude")]
|
|
[Description("Select the amplitude for the load.")]
|
|
[Id(1, 18)]
|
|
public abstract string AmplitudeName { get; set; }
|
|
//
|
|
[Category("Appearance")]
|
|
[DisplayName("Color")]
|
|
[Description("Select boundary condition color.")]
|
|
[Editor(typeof(UserControls.ColorEditorEx), typeof(UITypeEditor))]
|
|
[Id(1, 20)]
|
|
public abstract System.Drawing.Color Color { get; set; }
|
|
|
|
|
|
// Constructors
|
|
|
|
|
|
// Methods
|
|
public abstract CaeModel.DefinedField GetBase();
|
|
public override void UpdateRegionVisibility()
|
|
{
|
|
base.UpdateRegionVisibility();
|
|
// Hide SelectionHidden
|
|
DynamicTypeDescriptor.CustomPropertyDescriptor cpd;
|
|
if (base.RegionType == RegionTypeEnum.Selection.ToFriendlyString())
|
|
{
|
|
cpd = base.DynamicCustomTypeDescriptor.GetProperty(nameof(SelectionHidden));
|
|
cpd.SetIsBrowsable(false);
|
|
}
|
|
}
|
|
public void PopulateAmplitudeNames(string[] amplitudeNames)
|
|
{
|
|
List<string> names = new List<string>() { CaeModel.Amplitude.DefaultAmplitudeName };
|
|
names.AddRange(amplitudeNames);
|
|
DynamicCustomTypeDescriptor.PopulateProperty(nameof(AmplitudeName), names.ToArray(), false, 2);
|
|
}
|
|
}
|
|
}
|