using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.ComponentModel; using CaeGlobals; using DynamicTypeDescriptor; using CaeModel; namespace CPSO { [Serializable] public class ViewCLoad : ViewLoad { // Variables private CLoad _cLoad; // Properties public override string Name { get { return _cLoad.Name; } set { _cLoad.Name = value; } } // [Category("Region")] [OrderedDisplayName(2, 10, "Node set")] [Description("Select the node set for the creation of the load.")] [Id(3, 2)] public string NodeSetName { get { return _cLoad.RegionName; } set { _cLoad.RegionName = value; } } // [Category("Region")] [OrderedDisplayName(3, 10, "Reference point")] [Description("Select the reference point for the creation of the load.")] [Id(4, 2)] public string ReferencePointName { get { return _cLoad.RegionName; } set { _cLoad.RegionName = value; } } // [Category("Force components")] [OrderedDisplayName(0, 10, "F1")] [Description("Value of the force component per node in the direction of the first axis.")] [TypeConverter(typeof(EquationForceConverter))] [Id(1, 3)] public EquationString F1 { get { return _cLoad.F1.Equation; } set { _cLoad.F1.Equation = value; } } // [Category("Force components")] [OrderedDisplayName(1, 10, "F2")] [Description("Value of the force component per node in the direction of the second axis.")] [TypeConverter(typeof(EquationForceConverter))] [Id(2, 3)] public EquationString F2 { get { return _cLoad.F2.Equation; } set { _cLoad.F2.Equation = value; } } // [Category("Force components")] [OrderedDisplayName(2, 10, "F3")] [Description("Value of the force component per node in the direction of the third axis.")] [TypeConverter(typeof(EquationForceConverter))] [Id(3, 3)] public EquationString F3 { get { return _cLoad.F3.Equation; } set { _cLoad.F3.Equation = value; } } // [Category("Force magnitude")] [OrderedDisplayName(3, 10, "Magnitude")] [Description("Value of the force load magnitude per node.")] [TypeConverter(typeof(EquationForceConverter))] [Id(1, 4)] public EquationString Magnitude { get { return _cLoad.Magnitude.Equation; } set { _cLoad.Magnitude.Equation = value; } } // [Category("Force phase")] [OrderedDisplayName(0, 10, "Phase")] [Description("Value of the force phase.")] [TypeConverter(typeof(EquationAngleDegConverter))] [Id(1, 5)] public EquationString Phase { get { return _cLoad.PhaseDeg.Equation; } set { _cLoad.PhaseDeg.Equation = value; } } // public override string AmplitudeName { get { return _cLoad.AmplitudeName; } set { _cLoad.AmplitudeName = value; } } public override string CoordinateSystemName { get { return _cLoad.CoordinateSystemName; } set { _cLoad.CoordinateSystemName = value; } } public override System.Drawing.Color Color { get { return _cLoad.Color; } set { _cLoad.Color = value; } } // Constructors public ViewCLoad(CLoad cLoad) { // The order is important _cLoad = cLoad; // Dictionary regionTypePropertyNamePairs = new Dictionary(); regionTypePropertyNamePairs.Add(RegionTypeEnum.Selection, nameof(SelectionHidden)); regionTypePropertyNamePairs.Add(RegionTypeEnum.NodeSetName, nameof(NodeSetName)); regionTypePropertyNamePairs.Add(RegionTypeEnum.ReferencePointName, nameof(ReferencePointName)); SetBase(_cLoad, regionTypePropertyNamePairs); // DynamicCustomTypeDescriptor = ProviderInstaller.Install(this); // 2D DynamicCustomTypeDescriptor.GetProperty(nameof(F3)).SetIsBrowsable(!cLoad.TwoD); // Phase DynamicCustomTypeDescriptor.GetProperty(nameof(Phase)).SetIsBrowsable(_cLoad.Complex); } // Methods public override Load GetBase() { return _cLoad; } public void PopulateDropDownLists(string[] nodeSetNames, string[] referencePointNames, string[] amplitudeNames, string[] coordinateSystemNames) { Dictionary regionTypeListItemsPairs = new Dictionary(); regionTypeListItemsPairs.Add(RegionTypeEnum.Selection, new string[] { "Hidden" }); regionTypeListItemsPairs.Add(RegionTypeEnum.NodeSetName, nodeSetNames); regionTypeListItemsPairs.Add(RegionTypeEnum.ReferencePointName, referencePointNames); PopulateDropDownLists(regionTypeListItemsPairs); // PopulateAmplitudeNames(amplitudeNames); // PopulateCoordinateSystemNames(coordinateSystemNames); } } }