コード例 #1
0
        public virtual bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
        {
            if (actions == SupportedEditingActions.None)
            {
                return(true);
            }

            XmlConfigurationElement element = editableObject as XmlConfigurationElement;

            if (element != null)
            {
                /// do we match in full paths?
                if (string.Compare(this.Fullpath, element.Fullpath, true) == 0)
                {
                    /// does the element have changes, if not we don't need to bother
                    if (element.HasChanges)
                    {
                        /// yes so apply it's changed features
                        this.ElementName = element.ElementName;
                        this.Description = element.Description;
                        this.Category    = element.Category;
                        this.DisplayName = element.DisplayName;
                        this.Hidden      = element.Hidden;
                        this.Readonly    = element.Readonly;
                        this.Persistent  = element.Persistent;
                    }
                    return(true);
                }
            }


            return(false);
        }
コード例 #2
0
        public bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
        {
            XmlConfigurationOptionCollection options = editableObject as XmlConfigurationOptionCollection;

            if (options != null)
            {
                foreach (XmlConfigurationOption option in options)
                {
                    XmlConfigurationOption myOption = this[option.ElementName];
                    if (myOption != null)
                    {
                        try
                        {
                            myOption.ApplyChanges((ISupportsEditing)option, actions);
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex);
                        }
                    }
                }
            }
            return(true);
        }
        public bool ApplyChanges(ISupportsEditing editableObject, Carbon.Configuration.SupportedEditingActions actions)
        {
            XmlConfigurationCategoryCollection categories = editableObject as XmlConfigurationCategoryCollection;

            if (categories != null)
            {
                foreach (XmlConfigurationCategory category in categories)
                {
                    XmlConfigurationCategory myCategory = this[category.ElementName];
                    if (myCategory != null)
                    {
                        try
                        {
                            myCategory.ApplyChanges((ISupportsEditing)category, actions);
                        }
                        catch (Exception ex)
                        {
                            Debug.WriteLine(ex);
                        }
                    }
                }
            }
            return(true);
        }