Exemplo n.º 1
0
        /// <summary>
        /// Registers activities with specified name, display name, factory function, signature and activity type.
        /// </summary>
        /// <param name="name">The activity's name.</param>
        /// <param name="displayName">The activity's display name.</param>
        /// <param name="factoryFunction">The factory function to create new instance of the activity.</param>
        /// <param name="signature">The activity's signature.</param>
        /// <param name="activityType">The specified System.Type object representing the activity's type.</param>
        public void RegisterActivity(string name, string displayName, Func <Activity> factoryFunction, ActivitySignature signature, Type activityType)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");    // NOXLATE
            }
            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");    // NOXLATE
            }
            if (factoryFunction == null)
            {
                throw new ArgumentNullException("factoryFunction");    // NOXLATE
            }
            if (signature == null)
            {
                throw new ArgumentNullException("signature");    // NOXLATE
            }
            if (activityType == null)
            {
                throw new ArgumentNullException("activityType");    // NOXLATE
            }
            if (name.Length == 0)
            {
                throw new ArgumentException(String.Format(Properties.Resources.ArgumentExceptionMessage, "name"));  // NOXLATE
            }
            if (displayName.Length == 0)
            {
                throw new ArgumentException(String.Format(Properties.Resources.ArgumentExceptionMessage, "displayName"));  // NOXLATE
            }

            ActivityEntry entry = new ActivityEntry(name, displayName, factoryFunction, signature, activityType);

            activityEntries.Add(entry);
            typeDictionary[activityType] = entry;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Checks if the given activity can be used in rules defined
 /// by this rule signature
 /// </summary>
 /// <param name="activityEntry">Activity</param>
 /// <returns>Return true if it can be used, otherwise return false.</returns>
 public virtual bool IsActivityAvailable(ActivityEntry activityEntry)
 {
     return(Match(activityEntry.Signature));
 }