/// <summary> /// Applies the design-time policy to the given policy properties. /// </summary> private static PropertyDescriptorCollection ApplyDesignPolicy(CustomizationPolicySchema policy, IEnumerable<PropertyDescriptor> properties) { if (policy.Owner.IsCustomizationEnabled) { // Add the available customizable settings. properties = properties.Concat( policy.Settings .Select(setting => new ElementPropertyDescriptor( setting, setting.GetDomainClass().FindDomainProperty(Reflector<CustomizableSettingSchema>.GetProperty(elem => elem.Value).Name, true), new Attribute[] { //// Makes the property appear with the designated caption and description. new DisplayNameAttribute(setting.Caption), new DescriptionAttribute(setting.Description), //// Makes the property bold if it's modified from its default value, that is, IsModified=true. new DefaultValueAttribute(setting.DefaultValue), new ReadOnlyAttribute(IsSettingReadOnly(setting)), }))); //// IsModified is already UI readonly in the DSL } else { //// Remove IsModified properties = properties.Where(property => property.Name != Reflector<CustomizationPolicySchema>.GetProperty(elem => elem.IsModified).Name); } return new PropertyDescriptorCollection(properties.ToArray()); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.policy = this.store.ElementFactory.CreateElement <CustomizationPolicySchema>(); }); }
/// <summary> /// Applies the design-time policy to the given policy properties. /// </summary> private static PropertyDescriptorCollection ApplyDesignPolicy(CustomizationPolicySchema policy, IEnumerable <PropertyDescriptor> properties) { if (policy.Owner.IsCustomizationEnabled) { // Add the available customizable settings. properties = properties.Concat( policy.Settings .Select(setting => new ElementPropertyDescriptor( setting, setting.GetDomainClass().FindDomainProperty(Reflector <CustomizableSettingSchema> .GetProperty(elem => elem.Value).Name, true), new Attribute[] { //// Makes the property appear with the designated caption and description. new DisplayNameAttribute(setting.Caption), new DescriptionAttribute(setting.Description), //// Makes the property bold if it's modified from its default value, that is, IsModified=true. new DefaultValueAttribute(setting.DefaultValue), new ReadOnlyAttribute(IsSettingReadOnly(setting)), }))); //// IsModified is already UI readonly in the DSL } else { //// Remove IsModified properties = properties.Where(property => property.Name != Reflector <CustomizationPolicySchema> .GetProperty(elem => elem.IsModified).Name); } return(new PropertyDescriptorCollection(properties.ToArray())); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.policy = this.store.ElementFactory.CreateElement <CustomizationPolicySchema>(); this.setting = this.store.ElementFactory.CreateElement <CustomizableSettingSchema>(); this.policy.Settings.Add(this.setting); }); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.policy = this.store.ElementFactory.CreateElement<CustomizationPolicySchema>(); this.setting = this.store.ElementFactory.CreateElement<CustomizableSettingSchema>(); this.policy.Settings.Add(this.setting); }); }
public void Initialize() { this.store.TransactionManager.DoWithinTransaction(() => { this.policy = this.store.ElementFactory.CreateElement<CustomizationPolicySchema>(); }); }