public object Clone()
        {
            CustomPropertySchemaItem copy = new CustomPropertySchemaItem();

            copy.DefaultValue        = this.DefaultValue;
            copy.Description         = this.Description;
            copy.Name                = this.Name;
            copy.Type                = this.Type;
            copy.AppliesToCharacters = this.AppliesToCharacters;
            copy.AppliesToHotspots   = this.AppliesToHotspots;
            copy.AppliesToInvItems   = this.AppliesToInvItems;
            copy.AppliesToObjects    = this.AppliesToObjects;
            copy.AppliesToRooms      = this.AppliesToRooms;
            return(copy);
        }
        public CustomPropertySchemaItemEditor(CustomPropertySchemaItem item, bool isNewItem)
        {
            _itemToEdit = item;
            _copyOfItem = (CustomPropertySchemaItem)item.Clone();
            InitializeComponent();

            txtName.DataBindings.Add("Text", _copyOfItem, "Name", true, DataSourceUpdateMode.OnPropertyChanged);
            txtDescription.DataBindings.Add("Text", _copyOfItem, "Description", true, DataSourceUpdateMode.OnPropertyChanged);
            txtDefaultValue.DataBindings.Add("Text", _copyOfItem, "DefaultValue", true, DataSourceUpdateMode.OnPropertyChanged);
            chkCharacters.DataBindings.Add("Checked", _copyOfItem, "AppliesToCharacters", true, DataSourceUpdateMode.OnPropertyChanged);
            chkHotspots.DataBindings.Add("Checked", _copyOfItem, "AppliesToHotspots", true, DataSourceUpdateMode.OnPropertyChanged);
            chkInventory.DataBindings.Add("Checked", _copyOfItem, "AppliesToInvItems", true, DataSourceUpdateMode.OnPropertyChanged);
            chkObjects.DataBindings.Add("Checked", _copyOfItem, "AppliesToObjects", true, DataSourceUpdateMode.OnPropertyChanged);
            chkRooms.DataBindings.Add("Checked", _copyOfItem, "AppliesToRooms", true, DataSourceUpdateMode.OnPropertyChanged);
            cmbType.SelectedIndex = ((int)_copyOfItem.Type) - 1;

            if (!isNewItem)
            {
                txtName.Enabled = false;
            }
        }
 private void EditOrAddItem(CustomPropertySchemaItem schemaItem)
 {
     bool isNewItem = false;
     if (schemaItem == null) 
     {
         schemaItem = new CustomPropertySchemaItem();
         schemaItem.Type = CustomPropertyType.Boolean;
         isNewItem = true;
     }
     CustomPropertySchemaItemEditor itemEditor = new CustomPropertySchemaItemEditor(schemaItem, isNewItem);
     if (itemEditor.ShowDialog() == DialogResult.OK)
     {
         if (isNewItem)
         {
             if (!IsThereACustomPropertyWithThisName(schemaItem.Name.ToLower()))
             {
                 _schema.PropertyDefinitions.Add(schemaItem);
             }
         }
         RepopulateListView();
     }
     itemEditor.Dispose();
 }
 public CustomPropertyDescriptor(CustomPropertySchemaItem schemaItem, CustomProperties properties)
     : base(schemaItem.Name, new Attribute[] { new DescriptionAttribute(schemaItem.Description), new DefaultValueAttribute(schemaItem.GetTypedDefaultValue()) })
 {
     _properties = properties;
     _schemaItem = schemaItem;
 }
 public object Clone()
 {
     CustomPropertySchemaItem copy = new CustomPropertySchemaItem();
     copy.DefaultValue = this.DefaultValue;
     copy.Description = this.Description;
     copy.Name = this.Name;
     copy.Type = this.Type;
     copy.AppliesToCharacters = this.AppliesToCharacters;
     copy.AppliesToHotspots = this.AppliesToHotspots;
     copy.AppliesToInvItems = this.AppliesToInvItems;
     copy.AppliesToObjects = this.AppliesToObjects;
     copy.AppliesToRooms = this.AppliesToRooms;
     return copy;
 }