public void ShouldRegisterAttributeOnlyOnce() { AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[0])); Assert.IsTrue(container.RegisterAttribute("One", typeof(BrowsableAttribute))); Assert.IsFalse(container.RegisterAttribute("One", typeof(BrowsableAttribute))); }
/// <summary> /// Initializes a new instance of the <see cref="PropertyItem" /> class. /// </summary> /// <param name="owner">The owner.</param> /// <param name="component">The component property belongs to.</param> /// <param name="descriptor">The property descriptor</param> public PropertyItem(EffectPropertyEditorGrid owner, object component, PropertyDescriptor descriptor) : this(null) { if (owner == null) { throw new ArgumentNullException("owner"); } if (component == null) { throw new ArgumentNullException("component"); } if (descriptor == null) { throw new ArgumentNullException("descriptor"); } Owner = owner; Name = descriptor.Name; _component = component; _descriptor = descriptor; IsBrowsable = descriptor.IsBrowsable; _isReadOnly = descriptor.IsReadOnly; _description = descriptor.Description; CategoryName = descriptor.Category; IsLocalizable = descriptor.IsLocalizable; Metadata = new AttributesContainer(descriptor.Attributes); _descriptor.AddValueChanged(component, ComponentValueChanged); }
public void ShouldInitializeWithCollection() { AttributeCollection collection = new AttributeCollection(new Attribute[] { new BrowsableAttribute(true), new ReadOnlyAttribute(true) }); AttributesContainer container = new AttributesContainer(collection); Assert.IsNotNull(container["Browsable"]); Assert.IsNotNull(container["ReadOnly"]); }
public void ShouldTrancateAttributeSuffix() { AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[0])); container.RegisterAttribute("ExternalAttribute", typeof(BrowsableAttribute)); container.RegisterAttribute("Another", typeof(ReadOnlyAttribute)); Assert.IsNotNull(container["External"]); Assert.IsNotNull(container["Another"]); }
public override void Read(DataReaderBase reader) { UserId = Convert.ToInt32(reader[Columns.UserId]); FirstName = (string)reader[Columns.FirstName]; LastName = (string)reader[Columns.LastName]; Phone = (string)reader[Columns.Phone]; DefaultLangCode = (string)reader[Columns.DefaultLangCode]; Settings = JsonConvert.DeserializeObject <AttributesContainer>((string)reader[Columns.Settings]) ?? new AttributesContainer(); IsThisANewRecord = false; }
public void RefreshDescriptors(PropertyDescriptor descriptor) { Name = descriptor.Name; _descriptor = descriptor; IsBrowsable = descriptor.IsBrowsable; _isReadOnly = descriptor.IsReadOnly; _description = descriptor.Description; CategoryName = descriptor.Category; IsLocalizable = descriptor.IsLocalizable; Metadata = new AttributesContainer(descriptor.Attributes); _descriptor.AddValueChanged(Component, ComponentValueChanged); }
public PIM_Class(XCaseCanvas xCaseCanvas) : base(xCaseCanvas) { InitTemplate(); classAttributes = new AttributesContainer(AttributesSection, xCaseCanvas); classOperations = new OperationsContainer(OperationsSection, xCaseCanvas); Border[] stackBorders = new Border[] { HeaderBorder, PropertiesBorder, MethodsBorder }; ITextBoxContainer[] stackContainers = new ITextBoxContainer[] { classAttributes, classOperations }; classAttributes.StackBorders = stackBorders; classAttributes.StackContainers = stackContainers; classOperations.StackBorders = stackBorders; classOperations.StackContainers = stackContainers; InitContextMenu(); txtClassName.TextEdited += delegate(object sender, StringEventArgs args) { Controller.RenameElement <PIMClass>(args.Data, ((PIMClass)ModelElement).Package.Classes); }; PositionChanged += CancelAllEdits; txtClassName.MouseDoubleClick += txtClassName_MouseDoubleClick; }
public abstract AttributeState UpdateLogic(AttributesContainer _State);
public void ShouldNotRegisterAttribute() { AttributesContainer container = new AttributesContainer(new AttributeCollection(new Attribute[] { })); Assert.IsFalse(container.RegisterAttribute("Attribute", typeof(BrowsableAttribute))); }