Design Time Properties

The design time portion of the AgileExtender is used to configure properties that can be used at deployment time or runtime. The Designtime class is inherited from WFProcessPluggableAdapterDescriptor.

Every property has a Category, Description, and Visibility attribute. Multiple properties can be configured under the same Category. The attribute Browsable (true/false) is used to decide the visibility of the property.

You can override the Validate method to write custom logic for validating the user configurations.

The following code sample shows how you can write the design time AgileExtender.

using System;
using System.IO;
using System.Xml;
using System.ComponentModel;
using System.Drawing.Design;
using Ascentn.Workflow.Base;
using System.Xml.Serialization;

namespace Ascentn.AgileExtender.Sample
{
    /// <summary>
    /// This class is AgileExtender design time class that will be 
    /// used by AgilePoint Envision.
    /// </summary>
    public partial class MyAgileExtenderDescriptor : 
        WFProcessPluggableAdapterDescriptor
    {
        #region Fields
        private string m_Property1;
        private int m_Property2;
        private string m_ConfigItem1;
        private string m_ConfigItem2;
        #endregion Fields

        #region Constructor

        public MyAgileExtenderDescriptor()
        {
            m_Property1 = string.Empty;
            m_Property2 = 0;
            m_ConfigItem1 = string.Empty;
            m_ConfigItem2 = string.Empty;
        }

       
        #endregion

        #region [ Exposed Properties ]

        /// <summary>
        /// A sample property of type string
        /// </summary>
        [
            Category("Custom Property"),
            Description("description for Property1..."),
            XmlElement("Property1")
        ]
        public string Property1
        {
            get
            {
                return m_Property1;
            }
            set
            {
                m_Property1 = value;
            }
        }

        /// <summary>
        /// A sample property of type Integer
        /// </summary>
        [
        Category("Custom Property"),
        Description("description for Property2..."),
        XmlElement("Property2")
        ]
        public int Property2
        {
            get
            {
                return m_Property2;
            }
            set
            {
                m_Property2 = value;
            }
        }
        /// <summary>
        /// A sample property of type DialogBox
        /// </summary>

        [
            Category("Custom Property"),
            Description("Configure properties"),
            XmlElement("Configure"),
            Editor(typeof(WFProcessPluggableAdapterPropertyModalEditor
                <MyAgileExtenderDescriptor, AgileExtenderConfigForm>), 
                typeof(UITypeEditor))
        ]
        public string Configure
        {
            get
            {
                return "{Sample Configuration}";
            }
        }

        #endregion

        #region [ Hidden Properties ]

        [Browsable(false), XmlIgnore()]
        public override System.Xml.XmlDocument Configuration
        {
            get
            {
                string xml = ShUtil.Serialize(this);
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xml);
                return xmlDoc;
            }
            set
            {
                XmlDocument xmlDoc = value;
                MyAgileExtenderDescriptor aeDescriptor = 
                    (MyAgileExtenderDescriptor)ShUtil.Deserialize
                    (value.OuterXml, this.GetType());
                this.m_Property1 = aeDescriptor.m_Property1;
                this.m_Property2 = aeDescriptor.m_Property2;
                this.m_ConfigItem1 = aeDescriptor.m_ConfigItem1;
                this.m_ConfigItem2 = aeDescriptor.m_ConfigItem2;
            }
        }

        /// <summary>
        /// A sample property for Configuration DialogBox
        /// </summary>
        [
        Category("Custom Property"),
        Description("description for ConfigItem1..."),
        Browsable(false)
        ]
        public string ConfigItem1
        {
            get
            {
                string property = m_ConfigItem1;
                if (property == null) property = "";
                return property;
            }
            set
            {
                m_ConfigItem1 = value;
            }
        }

        /// <summary>
        /// A sample property for Configuration DialogBox
        /// </summary>
        [
        Category("Custom Property"),
        Description("description for ConfigItem2..."),
        Browsable(false)
        ]
        public string ConfigItem2
        {
            get
            {
                string property = m_ConfigItem2;
                if (property == null) property = "";
                return property;
            }
            set
            {
                m_ConfigItem2 = value;
            }
        }

        #endregion

        #region [ Validation methods ]

        /// <summary>
        /// Data Validation
        /// </summary>
        public override void Validate()
        {
            if (string.IsNullOrEmpty(m_Property1))
            {
                throw new InvalidDataException("Property1 of Agile 
                    Extender is required.");
            }
        }

        #endregion

       
    }
}