コード例 #1
0
        /// <summary>
        /// Set the resource action properties from the action properties
        /// </summary>
        /// <param name="actionProperties"></param>
        public void SetActionProperties(IActionPropertySet actionProperties)
        {
            if( actionProperties == null)
                return;

            foreach (KeyValuePair<string, IActionProperty> kvp in actionProperties)
            {
                IResourceActionProperty resourceActionProperty = new ResourceActionProperty();
                (resourceActionProperty as ResourceActionProperty).SetActionProperty(kvp.Key, kvp.Value);
                Add(resourceActionProperty);
            }
        }
コード例 #2
0
        public static void AddDataElementsToResource(XPathNavigator actionClassNode, IResourceAction resourceAction)
        {
            IResourceActionProperties resourceActionProperties = new ResourceActionProperties();
            XPathNodeIterator dataElementNodes = actionClassNode.Select(@"DataElements/DataElement");
            if (dataElementNodes != null && dataElementNodes.Count > 0)
            {
                while (dataElementNodes.MoveNext())
                {
                    IResourceActionProperty resourceActionProperty = new ResourceActionProperty();
                    XPathNavigator dataElementNode = dataElementNodes.Current;
                    AddDataElementToResource(dataElementNode, resourceActionProperty);
                    //ignore old EXECUTE property
                    if (!resourceActionProperty.Name.Equals("EXECUTE", StringComparison.InvariantCultureIgnoreCase))
                        resourceActionProperties.Add(resourceActionProperty);
                    else
                    {
                        bool value = Convert.ToBoolean(resourceActionProperty.Value, CultureInfo.InvariantCulture);
                        bool overridable = Convert.ToBoolean(resourceActionProperty.Override, CultureInfo.InvariantCulture);

                        if (overridable)
                        {
                            resourceAction.ExecutionOption = value ? ExecutionOption.OverridableDefaultTrue : ExecutionOption.OverridableDefaultFalse;
                        }
                        else
                        {
                            resourceAction.ExecutionOption = ExecutionOption.AlwaysExecute;
                        }
                    }
                }
            }

            (resourceAction as ResourceAction).Properties = resourceActionProperties;
        }