Activity Attribute Reference
The following topics describe the activity and property attributes that appear in the code generated by the Citrix PowerShell Converter and the Citrix Standard Activity template.
General Activity Attributes
[Designer( typeof (BaseActivityDesigner))]
Defines what activity designer will be used for the current activity. The "BaseActivityDesigner" is the Citrix designer, which renders an activity as the blue "bubble." The glass look, background color, selected glow, font, icon position, and other attributes are defined in "BaseActivityDesigner".
[DisplayNameAttribute( @"name" )]
Attribute allows you to specify the name for your activity. This is the name that will appear in the toolbox, and the same name that will appear on the activity in the design surface when dropped there. Any spaces in this name will be replaced with underscore characters when the activity is dropped on the design surface.
[Description( @"text" )]
Allows you to provide a brief text description of the activity. This text will appear at the bottom of the toolbox in the Workflow Designer console when the activity is selected in the toolbox. Typically, this text is short and simply gives a high-level overview of what the task does.
[ActivityTreePath( @"path/name" )]
Allows you to specify where you want this activity to appear in the toolbox. This is essentially the folder name. Note, use forward-slashes, not back-slashes, to separate folders in the path, if you have nested folders.
[ActivityValidator( typeof (CreateVMValidator))]
Defines which class is responsible for the validation logic of the activity. Typically each activity has its own, dedicated validator class and, if the provided activity template is used, will reside at the bottom of the activity .cs file.
[BaseActivityDesigner(ImageResourceName = @"name.png" , AssemblyType = typeof (CreateVM))]
| ImageResourceName (a 32x32 png icon/image) |
TextForeColor |
| ShineColor | ShapeRadius |
| GlowColor | TextFontFamily |
| GlowIntensity | TextFontSize |
| BackColor | Width |
| MaskColor | Height |
The AssemblyType is also required.
[ToolboxBitmapAttribute( typeof (CreateVM), @"name.png" )]
Allows you to specify the 16x16 image file to use as the icon for the activity in the toolbox (tree view). The image must be a .png file. The image does not need to be the exact same image as that supplied in the BaseActivityDesigner attribute, but usually is.
[DesignerSerializer( typeof (BindingListSerializer), typeof (WorkflowMarkupSerializer))]
If you have any BindingList<> properties in this activity your activity needs to declare a DesignerSerializer attribute calling the Citrix BindingListSerializer.
[ActivityReferenceAssemblies(new string[]{ @"assembly" })]
Allows you to specify one or more additional assemblies that must be referenced by the workflow project. By default, if an activity references an assembly, that referenced assembly will be added as a reference to the workflow project. However, sometimes an assembly isn't referenced to an activity and therefore needs to be specified using this attribute. This informs the Workflow Designer to manually add the specified assembly as a reference to the workflow project.
The ActivityReferenceAssembliesAttribute takes one parameter which is a string that is expected to be the full name of the assembly. For example:
[ActivityReferenceAssemblies(new string[]{ _@"XenDotNetLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3509c8c16f49bbe9"_ })]
In the process of handling this attribute to create a project reference, a call to Assembly.ReflectionOnlyLoad() is made assuming that the string is the assembly FullName. That ReflectionOnlyLoad() call is very forgiving in that it will accept just the assembly name or the assembly name and version, etc. So, if you provide just the assembly name like the following:
[ActivityReferenceAssemblies(new string[]{ _@"XenDotNetLibrary"_ })]
It will work just fine. Just be aware that if the activity which is decorated by the above attribute ("XenDotNetLibrary" in this case) needs to reference a specific version of the XenDotNetLibrary assembly in the future, then that string above will need the version number added.
[BindTypesOverride( "Input" , new Type[]{ typeof (String) })] [BindTypesOverride( "Output" , new Type[] { typeof (String) })]
Allows you to specify additional data types to which the Input or Output properties can be bound.
PowerShell-Specific Activity Attributes
[CTXPSCmdletInfoAttribute( @"cmdlet", @"snapIn" )]
Allows you to specify the Powershell cmdlet that an activity runs. This attribute is applicable to activity classes that inherit from PSActivityBase. PSActivityBase::Execute will execute the specified Powershell cmdlet, with the parameters specified by the CTXPSParameterInfo attributes.
The first parameter is the cmdlet name. The second (optional) parameter is the snap-in name. If a snap-in name is specified, that snap-in will be loaded in the runspace before the cmdlet is called).
[CTXPSParameterInfo( "browserName" , AttributeType = CTXPSParameterInfoAttribute.CTXAttributeType. NonEmptyString)]
Allows you to map activity properties to Powershell parameters. This attribute should be applied to properties (or dependency properties) of an activity class that inherits from PSActivityBase. The common code in PSActivityBase adds the Powershell cmdlet parameters, using the activity properties, as specified by this attribute. The first parameter is the Powershell parameter name. The second parameter (AttributeType) specifies how the value for that Powershell parameter should be handled (i.e. string, PSObject, SwitchParameter, etc.)
[HiddenPSSnapIn( "assemblyName" )]
Allows you to specify a Powershell snap-in to be dynamically loaded at runtime. This allows you to use Powershell cmdlets that are not defined in a registered PSSnapin on the computer. It takes one parameter, which is expected to be the full name of the assembly. For example:
[HiddenPSSnapIn("XenAppCmdlets, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
The assembly is loaded, and any cmdlets within it are dynamically added to the runspace. This attribute applies to activity classes that inherit from PSActivityBase.
Dependency Property Attributes
[DefaultValue( @"" )]
Allows you to specify a value that the property grid will identify as the default value. If supplied, default values appear as normal text and when the value is changed from the default the value appears as bold text.
Note: The actual default value for a dependency property must be set in the constructor for the activity class. This attribute simply alters the behavior of the property in the property grid.
[Category( @"Parameters" )]
Allows you to specify the group within the property grid where you want the property to appear. The normal default for Workflow Studio activities is "Parameters". Consider placing parameters that are optional under a different category.
[DisplayName( @"Message Text" )]
Allows you to specify the name of the property as it will appear in the property grid (in the left-hand column of the property grid).
[Description( @"Specify the text to display in the message box." )]
Allows you to specify a text description of the property. This text description will appear at the bottom of the property grid when the property is selected in the property grid.
[Browsable( true )]
Allows you to specify whether the property will appear in the property grid. If omitted, the property will be displayed. If supplied and the attribute value set to "false", the property will not be displayed.
[InputAttribute]
Allows you to specify whether the property is an input type of property. Using this attribute simply puts an "input" icon next to the property in the binding drop-down.
Note: If this attribute is include, the OutputAttribute should not be included.
[OutputAttribute]
Allows you to specify whether the property is an output type of property. Output properties receive a special "output" icon next to the property in the binding drop-down, and they will always appear in the TextEditor editor, regardless of their data type.
Note: If this attribute is included, the InputAttribute should not be included.
[EditorAttribute( typeof (TextEditor), typeof (UITypeEditor))]
Allows you to specify which property editors, if any, are associated with this property. Any editor can be used, but the following is a list of available editors included with Workflow Studio:
| BindingDropDownListEditor | OpenFileEditor |
| DropDownList | OpenFolderEditor |
| DSComputerPicker | PasswordEditor |
| DSGroupPathPicker | PropertyColumnEditor |
| DSObjectPathPicker | StringEdit |
| DSOUPicker | StringWithConstructor |
| EditorHelper | TextEditor |
| FileWithConstructor | TrusteeEditor |
| FolderWithConstructor | VariableEdit |
| NamedCollectionEditor | |
[ReadOnly( true )]
Allows you to specify whether the property value is allowed to change. Setting the ReadOnly attribute value to "true" will restrict the value from being changed by the user.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
System.ComponentModel.DesignerSerializationVisibilityAttribute specifies what part of a property should be serialized by the designer. This attribute is usually necessary when creating custom Web and Windows controls.
This attribute takes one parameter, which is a System.ComponentModel.DesignerSerializationVisibility enumeration member:
- Visible: Specifies that the object should be serialized. Use this value for simple (or primitive) properties.
- Conten: Specifies that contents of the object should be serialized. Use this value for complex (or non-primitive) properties and collections.
- Hidden: Specifies that the object should not be serialized. Use this value when properties are changed for design-time purposes only, but should not be serialized in code.
In Workflow Studio, this attribute is used for most properties to ensure proper serialization during design time.
[BindTypes( new Type []{ typeof (String) })]
Allows you to specify alternate/additional property types that are allowed to bind to this property. This is used in several activities but the best example is the Simple Math activity. In that activity there are two input properties for the two input numbers that are going to be used to perform a mathematic operation with. Some other activities may output numbers that can/should be used by Simple Math in varying types - Int32, Int64, Float, Double, Decimal, Object, or even a String. Putting these types into the BindTypes attribute allows the input properties of the Simple Math activity to be bound to any property that is one of those types.
Note: Care must be taken to cast the input type appropriately so that exceptions are not encountered when using the bound property values in the activity.
[ShowInWFSEditors]
Allows you to override the Browsable attribute to cause properties to show up in the TextEditor editor, even though they may be hidden in the property grid itself.
PowerShell-Specific Property Attribute
[CTXPSParameterInfo( @"ServerName" , AttributeType = CTXPSParameterInfoAttribute.CTXAttributeType.String)]
Allows you to define identify a property as a parameter to the cmdlet. The first parameter to this attribute is the cmdlet parameter name, the second is the cmdlet parameter type. Valid parameter types are:
| Boolean | Long | String |
| BoolString | NonEmptyString | StringList |
| Dictionary | Object | Switch |
| Enumeration | Password | UInt |
| Guid | PSCredential | UInt32 |
| Int | PSObject | ULong |
| Int32 | PSObjectArray | Unknown |
| IntList | |
|
Add Comment