/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => HostName, Strings.TabConnection, Strings.HostNameName, Strings.HostNameHelp); properties.Add(() => Port, Strings.TabConnection, Strings.PortName, Strings.PortHelp); properties.Add(() => TopicPrefix, Strings.TabConnection, Strings.TopicPrefixName, Strings.TopicPrefixHelp); }
/// <summary> /// Collect all attributes from the given property. /// Adjust / add category and display name /// </summary> private static Attribute[] GetAttributes(ExPropertyDescriptorCollection collection, PropertyInfo propertyInfo, IEnumerable <Attribute> attributes, string category, string displayName, string description) { var attrs = (propertyInfo != null) ? propertyInfo.GetCustomAttributes(false).Cast <Attribute>().ToList() : new List <Attribute>(); if (attributes != null) { attrs.AddRange(attributes); } attrs.RemoveAll(x => x is CategoryAttribute); attrs.RemoveAll(x => x is DisplayNameAttribute); attrs.RemoveAll(x => x is DescriptionAttribute); attrs.Add(new CategoryAttribute(category)); attrs.Add(new DisplayNameAttribute(displayName)); attrs.Add(new DescriptionAttribute(description)); if (collection.InRunningState) { // Mark property readonly when not attributed as editable in running state if (!attrs.OfType <EditableInRunningStateAttribute>().Any()) { attrs.RemoveAll(x => x is EditorAttribute); attrs.Add(new ReadOnlyAttribute(true)); attrs.Add(new EditorAttribute(typeof(NoEditor), typeof(UITypeEditor))); } } return(attrs.ToArray()); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => ZoomFactor, Strings.TabDesign, "Zoom factor", "Use this property to scale the module"); properties.Add(() => Size, Strings.TabPosition, Strings.SizeName, Strings.ModuleSizeHelp); properties.Add(() => Description, Strings.TabGeneral, Strings.DescriptionName, Strings.DescriptionHelp); }
/// <summary> /// Add settings for the given property /// </summary> internal static PropertyDescriptor Add <TComponent, TProperty>(this ExPropertyDescriptorCollection collection, Func <TComponent, TProperty> getter, Action <TComponent, TProperty> setter, TProperty defaultValue, string name, string category, string displayName, string description, params Attribute[] attributes) { var descriptor = new DynamicPropertyDescriptor <TComponent, TProperty>(name, getter, setter, defaultValue, GetAttributes(collection, null, attributes, category, displayName, description)); collection.Add(descriptor); return(descriptor); }
/// <summary> /// Add settings for the given property /// </summary> internal static PropertyDescriptor Add(this ExPropertyDescriptorCollection collection, Expression <Func <object> > member, string category, string displayName, string description) { var prop = Member.Of(member).AsProperty(); var descriptor = TypeDescriptor.CreateProperty(prop.DeclaringType, prop.Name, prop.PropertyType, GetAttributes(collection, prop, null, category, displayName, description)); collection.Add(descriptor); return(descriptor); }
/// <summary> /// Gets the properties of the specified component that match the specified attributes. /// </summary> /// <returns> /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> that contains the properties. /// </returns> /// <param name="component">The component to retrieve properties from. /// </param><param name="attributes">An array of type <see cref="T:System.Attribute"/> that indicates the attributes of the properties to retrieve. /// </param> public override PropertyDescriptorCollection GetProperties(object component, Attribute[] attributes) { var result = new ExPropertyDescriptorCollection(grid.InRunningState); var settings = component as IGatherProperties; if (settings != null) { settings.GatherProperties(result); } return(result); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Address1, Strings.TabGeneral, "Address 1", "Address of bit 1"); properties.Add(() => Address2, Strings.TabGeneral, "Address 2", "Address of bit 2"); properties.Add(() => MorningPattern, Strings.TabBehavior, "Morning pattern", "Bit pattern used to indicate 'morning'"); properties.Add(() => AfternoonPattern, Strings.TabBehavior, "Afternoot pattern", "Bit pattern used to indicate 'afternoon'"); properties.Add(() => EveningPattern, Strings.TabBehavior, "Evening pattern", "Bit pattern used to indicate 'evening'"); properties.Add(() => NightPattern, Strings.TabBehavior, "Night pattern", "Bit pattern used to indicate 'night'"); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public virtual void GatherProperties(ExPropertyDescriptorCollection properties) { if (ShowDescription) { properties.Add(() => Description, Strings.TabGeneral, Strings.DescriptionName, Strings.DescriptionHelp); } if (ShowUsedBy) { properties.Add(() => UsedBy, Strings.TabUsage, Strings.UsedByName, Strings.UsedByHelp); } }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => PreferredDccCommandStation, Strings.TabBehavior, Strings.PreferredDccCommandStationName, Strings.PreferredDccCommandStationHelp); properties.Add(() => PreferredLocoNetCommandStation, Strings.TabBehavior, Strings.PreferredLocoNetCommandStationName, Strings.PreferredLocoNetCommandStationHelp); properties.Add(() => PreferredMotorolaCommandStation, Strings.TabBehavior, Strings.PreferredMotorolaCommandStationName, Strings.PreferredMotorolaCommandStationHelp); properties.Add(() => PreferredMfxCommandStation, Strings.TabBehavior, Strings.PreferredMfxCommandStationName, Strings.PreferredMfxCommandStationHelp); properties.Add(() => PreferredMqttCommandStation, Strings.TabBehavior, Strings.PreferredBinkyNetCommandStationName, Strings.PreferredBinkyNetCommandStationHelp); properties.Add(() => ClockSpeedFactor, Strings.TabBehavior, Strings.ClockSpeedFactorName, Strings.ClockSpeedFactorHelp); properties.Add(() => MqttHostName, Strings.TabServer, Strings.MqttHostNameName, Strings.MqttHostNameHelp); properties.Add(() => MqttPort, Strings.TabServer, Strings.MqttPortName, Strings.MqttPortHelp); properties.Add(() => MqttTopic, Strings.TabServer, Strings.MqttTopicName, Strings.MqttTopicHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => X, Strings.TabPosition, Strings.XName, Strings.XHelp); properties.Add(() => Y, Strings.TabPosition, Strings.YName, Strings.YHelp); if (ShowSize) { properties.Add(() => Width, Strings.TabPosition, Strings.WidthName, Strings.WidthHelp); properties.Add(() => Height, Strings.TabPosition, Strings.HeightName, Strings.HeightHelp); } properties.Add(() => Rotation, Strings.TabPosition, Strings.RotationName, Strings.RotationHelp); properties.Add(() => Locked, Strings.TabPosition, Strings.LockedName, Strings.LockedHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Address, Strings.TabGeneral, Strings.AddressName, Strings.AddressHelp); properties.Add(() => Image, Strings.TabDesign, Strings.LocImageName, Strings.LocImageHelp); properties.Add(() => MaximumSpeed, Strings.TabBehavior, Strings.MaximumSpeedName, Strings.LocMaximumSpeedHelp); properties.Add(() => MediumSpeed, Strings.TabBehavior, Strings.MediumSpeedName, "Speed of this loc used to enter a block where this loc should stop (as percentage of the maximum #speed steps)."); properties.Add(() => SlowSpeed, Strings.TabBehavior, Strings.MinimumSpeedName, "Speed of this loc used to enter a block where this loc should stop (as percentage of the maximum #speed steps)."); properties.Add(() => ChangeDirection, Strings.TabBehavior, Strings.ChangeDirectionName, Strings.LocChangeDirectionHelp); properties.Add(() => Functions, Strings.TabGeneral, Strings.LocFunctionsName, Strings.LocFunctionsHelp); properties.Add(() => Owner, Strings.TabGeneral, Strings.LocOwnerName, Strings.LocOwnerHelp); properties.Add(() => Remarks, Strings.TabGeneral, Strings.LocRemarksName, Strings.LocRemarksHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Address1, Strings.TabGeneral, "Address 1", "Address of bit 1."); properties.Add(() => Address2, Strings.TabGeneral, "Address 2", "Address of bit 2."); properties.Add(() => Address3, Strings.TabGeneral, "Address 3", "Address of bit 3."); properties.Add(() => Address4, Strings.TabGeneral, "Address 4", "Address of bit 4."); properties.Add(() => RedPattern, Strings.TabBehavior, "Red bit pattern", "Bit pattern needed to set the Red color."); properties.Add(() => GreenPattern, Strings.TabBehavior, "Green bit pattern", "Bit pattern needed to set the Green color."); properties.Add(() => YellowPattern, Strings.TabBehavior, "Yellow bit pattern", "Bit pattern needed to set the Yellow color."); properties.Add(() => WhitePattern, Strings.TabBehavior, "White bit pattern", "Bit pattern needed to set the White color."); properties.Add(() => Block, Strings.TabGeneral, "Block", "Block this signal protects."); properties.Add(() => Position, Strings.TabGeneral, "Position", "Side the block this signal is facing."); properties.Add(() => Type, Strings.TabGeneral, "Type", "Type of signal."); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => WaitProbability, Strings.TabBehavior, Strings.WaitProbabilityName, Strings.WaitProbabilityHelp); properties.Add(() => WaitPermissions, Strings.TabAdvBehavior, Strings.WaitPermissionsName, Strings.WaitPermissionsHelp); if ((WaitProbability > 0) || ChangeDirectionReversingLocs) { properties.Add(() => MinimumWaitTime, Strings.TabBehavior, Strings.MinimumWaitTimeName, Strings.MinimumWaitTimeHelp); properties.Add(() => MaximumWaitTime, Strings.TabBehavior, Strings.MaximumWaitTimeName, Strings.MaximumWaitTimeHelp); } properties.Add(() => ReverseSides, Strings.TabDesign, Strings.ReverseSidesName, Strings.ReverseSidesHelp); properties.Add(() => ChangeDirection, Strings.TabBehavior, Strings.ChangeDirectionName, Strings.ChangeDirectionHelp); properties.Add(() => ChangeDirectionReversingLocs, Strings.TabAdvBehavior, Strings.ChangeDirectionReversingLocsName, Strings.ChangeDirectionReversingLocsHelp); properties.Add(() => StationMode, Strings.TabBehavior, Strings.StationModeName, Strings.StationModeHelp); properties.Add(() => BlockGroup, Strings.TabBehavior, Strings.BlockGroupName, Strings.BlockGroupHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => PositionAddress1, Strings.TabGeneral, "Position address 1", "Address of position bit 1."); properties.Add(() => PositionAddress2, Strings.TabGeneral, "Position address 2", "Address of position bit 2."); properties.Add(() => PositionAddress3, Strings.TabGeneral, "Position address 3", "Address of position bit 3."); properties.Add(() => PositionAddress4, Strings.TabGeneral, "Position address 4", "Address of position bit 4."); properties.Add(() => PositionAddress5, Strings.TabGeneral, "Position address 5", "Address of position bit 5."); properties.Add(() => PositionAddress6, Strings.TabGeneral, "Position address 6", "Address of position bit 6."); properties.Add(() => InvertPositions, Strings.TabGeneral, "Invert position addresses", "When set, position bits are sent inverted to the turntable."); properties.Add(() => WriteAddress, Strings.TabGeneral, "Write signal address", "Address of 'write address in progress bit'."); properties.Add(() => InvertWrite, Strings.TabGeneral, "Invert write signal", "When set, write signal address bits is inverted."); properties.Add(() => BusyAddress, Strings.TabGeneral, "Busy signal address", "Address of 'turntable is busy bit'."); properties.Add(() => InvertBusy, Strings.TabGeneral, "Invert busy signal", "When set, busy signal address bits is inverted."); properties.Add(() => FirstPosition, Strings.TabGeneral, "First position", "Lowest position number allowed by the turntable."); properties.Add(() => LastPosition, Strings.TabGeneral, "Last position", "Highest position number allowed by the turntable."); properties.Add(() => InitialPosition, Strings.TabBehavior, "Initial position", "Position number used to initialize the turntable with."); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); //properties.Add(() => Locs, Strings.TabGeneral, Strings.LocGroupLocsName, Strings.LocGroupLocsHelp); var i = 0; var locAttr = new Attribute[] { new TypeConverterAttribute(typeof(LocIsElementOfGroupTypeConverter)), new MergablePropertyAttribute(false), new EditableInRunningStateAttribute() }; foreach (var iterator in Context.AppState.Package.Railway.GetLocs()) { var loc = iterator; properties.Add <LocGroupSettings, bool>(s => s.IsElement(loc), (s, x) => s.SetIsElement(loc, x), false, "loc" + i, Strings.TabLocs, loc.Description, string.Format(Strings.IsXElementOfGroupHelp, loc.Description), locAttr); i++; } }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Address, Strings.TabGeneral, Strings.AddressName, Strings.AddressHelp); if (HasFeedback) { properties.Add(() => FeedbackAddress, Strings.TabGeneral, Strings.FeedbackAddressName, Strings.FeedbackAddressHelp); } properties.Add(() => HasFeedback, Strings.TabBehavior, Strings.SwitchHasFeedbackName, Strings.SwitchHasFeedbackHelp); if (!HasFeedback) { properties.Add(() => SwitchDuration, Strings.TabBehavior, Strings.SwitchDurationName, Strings.SwitchDurationHelp); } properties.Add(() => Invert, Strings.TabBehavior, Strings.SwitchInvertedName, Strings.SwitchInvertedHelp); if (HasFeedback && (FeedbackAddress != null)) { properties.Add(() => InvertFeedback, Strings.TabBehavior, Strings.SwitchFeedbackInvertedName, Strings.SwitchFeedbackInvertedHelp); } properties.Add(() => InitialDirection, Strings.TabBehavior, Strings.SwitchInitialDirectionName, Strings.SwitchInitialDirectionHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => From, Strings.TabGeneral, Strings.RouteFromName, Strings.RouteFromHelp); if (!(From is IEdge)) { properties.Add(() => FromBlockSide, Strings.TabGeneral, Strings.RouteFromSideName, Strings.RouteFromSideHelp); } properties.Add(() => To, Strings.TabGeneral, Strings.RouteToName, Strings.RouteToHelp); if (!(To is IEdge)) { properties.Add(() => ToBlockSide, Strings.TabGeneral, Strings.RouteToSideName, Strings.RouteToSideHelp); } properties.Add(() => Events, Strings.TabBehavior, "Events", "Events that control the state of this route and the speed of the loc that takes this route"); properties.Add(() => JunctionsWithState, Strings.TabBehavior, Resources.RouteJunctionsName, Resources.RouteJunctionsHelp); properties.Add(() => Speed, Strings.TabBehavior, Resources.RouteSpeedName, Resources.RouteSpeedHelp); properties.Add(() => ChooseProbability, Strings.TabAdvBehavior, Strings.ChooseProbabilityName, Strings.ChooseProbabilityHelp); properties.Add(() => Permissions, Strings.TabAdvBehavior, Strings.RoutePermissionsName, Strings.RoutePermissionsHelp); properties.Add(() => Closed, Strings.TabAdvBehavior, Strings.RouteClosedName, Strings.RouteClosedHelp); properties.Add(() => MaxDuration, Strings.TabAdvBehavior, Strings.RouteMaxDurationName, Strings.RouteMaxDurationHelp); properties.Add(() => ActionTriggerSource, Strings.TabBehavior, Strings.ActionsName, Strings.ActionsHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => EdgeA, Strings.TabGeneral, "Edge A", "The edge on the first module of this connection."); properties.Add(() => EdgeB, Strings.TabGeneral, "Edge B", "The edge on the second module of this connection."); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Image, Strings.TabDesign, Strings.ModuleBackgroundImageName, Strings.ModuleBackgroundImageHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { properties.Add(() => Block, Strings.TabGeneral, Strings.JunctionBlockName, Strings.JunctionBlockHelp); base.GatherProperties(properties); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Loc, Strings.TabGeneral, "Loc", "Loc..."); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Junction, Strings.TabGeneral, "Junction", "The junction to set to it's initial position"); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Sound, Strings.TabGeneral, "Sound", "The sound file that will be played"); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Function, Strings.TabGeneral, "Function", "function..."); properties.Add(() => Command, Strings.TabGeneral, "Command", "command..."); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => MinimumLocsInGroup, Strings.TabBehavior, Strings.MinimumLocsInGroupName, Strings.MinimumLocsInGroupHelp); properties.Add(() => MinimumLocsOnTrackForMinimumLocsInGroupStart, Strings.TabBehavior, Strings.MinimumLocsOnTrackForMinimumLocsInGroupStartName, Strings.MinimumLocsOnTrackForMinimumLocsInGroupStartHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => Address, Strings.TabGeneral, Strings.AddressName, Strings.AddressHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => LastModified, Strings.TabGeneral, Strings.LastModifiedName, Strings.LastModifiedHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { base.GatherProperties(properties); properties.Add(() => ComPortName, Strings.TabConnection, Strings.ComPortNameName, Strings.ComPortNameHelp); }
/// <summary> /// Add all visible properties of this settings object to the given property collection. /// </summary> public override void GatherProperties(ExPropertyDescriptorCollection properties) { properties.Add(() => Block, Strings.TabGeneral, Strings.SensorBlockName, Strings.SensorBlockHelp); properties.Add(() => Shape, Strings.TabDesign, Strings.SensorShapeName, Strings.SensorShapeHelp); base.GatherProperties(properties); }