private void createArrayPropertyEditor(int itemIndex, Type editorType, bool isSelected)
        {
            Debug.Check(_arrayProperty != null);

            string propertyName = string.Format("{0}", itemIndex);
            Label  label        = propertyGrid.AddProperty(propertyName, editorType, _arrayProperty.ReadOnly);

            label.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
            label.MouseClick += new MouseEventHandler(label_MouseClick);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            if (Plugin.IsCustomClassType(_arrayProperty.ItemType))
            {
                editor.SetStructProperty(new DesignerStructPropertyInfo(
                                             _arrayProperty.ItemType.Name, _arrayProperty.ItemType, _arrayProperty.ItemList[itemIndex], itemIndex),
                                         _object);
            }
            else
            {
                DesignerArrayPropertyInfo arrayProperty = new DesignerArrayPropertyInfo(_arrayProperty);
                arrayProperty.ItemIndex = itemIndex;

                editor.SetArrayProperty(arrayProperty, _object);
            }

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;

            if (isSelected)
            {
                selectLabel(label);
            }
        }
Beispiel #2
0
 public DesignerArrayPropertyInfo(DesignerArrayPropertyInfo arrayProperty)
 {
     _name      = arrayProperty.Name;
     _itemType  = arrayProperty.ItemType;
     _itemList  = arrayProperty.ItemList;
     _itemIndex = arrayProperty.ItemIndex;
     _readOnly  = arrayProperty.ReadOnly;
 }
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            setObject(obj);

            buildPropertyGrid();
        }
Beispiel #4
0
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            setObject(obj);

            buildPropertyGrid();
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            textBox.Text = (arrayProperty.Value != null) ? trimQuotes(arrayProperty.Value.ToString()) : string.Empty;

            if (Plugin.IsCharType(arrayProperty.Value.GetType())) {
                textBox.MaxLength = 1;
            }
        }
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            _object = obj;
            _node = _object as Nodes.Node;

            buildPropertyGrid();
        }
        public void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            Debug.Check(arrayProperty != null);

            _arrayProperty = arrayProperty;
            _object        = obj;
            _node          = _object as Nodes.Node;

            buildPropertyGrid();
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            textBox.Text = (arrayProperty.Value != null) ? trimQuotes(arrayProperty.Value.ToString()) : string.Empty;

            if (Plugin.IsCharType(arrayProperty.Value.GetType()))
            {
                textBox.MaxLength = 1;
            }
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            clear();

            Array list = Enum.GetValues(arrayProperty.ItemType);
            string enumName = DesignerEnum.GetDisplayName(arrayProperty.Value);

            foreach(object enumVal in list) {
                _allValues.Add(enumVal);

                if (DesignerEnum.GetDisplayName(enumVal) == enumName) {
                    _values.Add(enumVal);
                    comboBox.Items.Add(enumName);
                }
            }

            comboBox.Text = enumName;
        }
Beispiel #10
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            clear();

            Array  list     = Enum.GetValues(arrayProperty.ItemType);
            string enumName = DesignerEnum.GetDisplayName(arrayProperty.Value);

            foreach (object enumVal in list)
            {
                _allValues.Add(enumVal);

                if (DesignerEnum.GetDisplayName(enumVal) == enumName)
                {
                    _values.Add(enumVal);
                    comboBox.Items.Add(enumName);
                }
            }

            comboBox.Text = enumName;
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            checkBox.Checked = (arrayProperty.Value != null) ? (bool)arrayProperty.Value : false;
        }
Beispiel #12
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            update();
        }
Beispiel #13
0
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            decimal value = 0;

            if (arrayProperty.ItemType == typeof(float))
            {
                const float maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                float val = (float)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(double))
            {
                const double maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                double val = (double)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(int))
            {
                SetRange(0,
                         (decimal)int.MinValue,
                         (decimal)int.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(uint))
            {
                SetRange(0,
                         (decimal)uint.MinValue,
                         (decimal)uint.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(short))
            {
                SetRange(0,
                         (decimal)short.MinValue,
                         (decimal)short.MaxValue,
                         (decimal)1);

                short val = (short)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(ushort))
            {
                SetRange(0,
                         (decimal)ushort.MinValue,
                         (decimal)ushort.MaxValue,
                         (decimal)1);

                ushort val = (ushort)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(sbyte))
            {
                SetRange(0,
                         (decimal)sbyte.MinValue,
                         (decimal)sbyte.MaxValue,
                         (decimal)1);

                sbyte val = (sbyte)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(byte))
            {
                SetRange(0,
                         (decimal)byte.MinValue,
                         (decimal)byte.MaxValue,
                         (decimal)1);

                byte val = (byte)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(long))
            {
                SetRange(0,
                         (decimal)long.MinValue,
                         (decimal)long.MaxValue,
                         (decimal)1);

                long val = (long)arrayProperty.Value;
                value = (decimal)val;
            }
            else if (arrayProperty.ItemType == typeof(ulong))
            {
                SetRange(0,
                         (decimal)ulong.MinValue,
                         (decimal)ulong.MaxValue,
                         (decimal)1);

                ulong val = (ulong)arrayProperty.Value;
                value = (decimal)val;
            }
            else
            {
                Debug.Check(false);
            }

            numericUpDown.Value = Math.Max(numericUpDown.Minimum, Math.Min(numericUpDown.Maximum, value));
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
        {
            base.SetArrayProperty(arrayProperty, obj);

            update();
        }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            decimal value = 0;

            if (arrayProperty.ItemType == typeof(float)) {
                const float maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                float val = (float)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(double)) {
                const double maxValue = 1000000000000;
                SetRange(2,
                         (decimal)(-maxValue),
                         (decimal)maxValue,
                         (decimal)0.01);

                double val = (double)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(int)) {
                SetRange(0,
                         (decimal)int.MinValue,
                         (decimal)int.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(uint)) {
                SetRange(0,
                         (decimal)uint.MinValue,
                         (decimal)uint.MaxValue,
                         (decimal)1);

                int val = (int)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(short)) {
                SetRange(0,
                         (decimal)short.MinValue,
                         (decimal)short.MaxValue,
                         (decimal)1);

                short val = (short)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(ushort)) {
                SetRange(0,
                         (decimal)ushort.MinValue,
                         (decimal)ushort.MaxValue,
                         (decimal)1);

                ushort val = (ushort)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(sbyte)) {
                SetRange(0,
                         (decimal)sbyte.MinValue,
                         (decimal)sbyte.MaxValue,
                         (decimal)1);

                sbyte val = (sbyte)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(byte)) {
                SetRange(0,
                         (decimal)byte.MinValue,
                         (decimal)byte.MaxValue,
                         (decimal)1);

                byte val = (byte)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(long)) {
                SetRange(0,
                         (decimal)long.MinValue,
                         (decimal)long.MaxValue,
                         (decimal)1);

                long val = (long)arrayProperty.Value;
                value = (decimal)val;

            } else if (arrayProperty.ItemType == typeof(ulong)) {
                SetRange(0,
                         (decimal)ulong.MinValue,
                         (decimal)ulong.MaxValue,
                         (decimal)1);

                ulong val = (ulong)arrayProperty.Value;
                value = (decimal)val;

            } else {
                Debug.Check(false);
            }

            numericUpDown.Value = Math.Max(numericUpDown.Minimum, Math.Min(numericUpDown.Maximum, value));
        }
 public virtual void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
 {
     _arrayProperty = arrayProperty;
     _object        = obj;
 }
        public override void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj) {
            base.SetArrayProperty(arrayProperty, obj);

            checkBox.Checked = (arrayProperty.Value != null) ? (bool)arrayProperty.Value : false;
        }
        private void createArrayPropertyEditor(int itemIndex, Type editorType, bool isSelected) {
            Debug.Check(_arrayProperty != null);

            string propertyName = string.Format("{0}", itemIndex);
            Label label = propertyGrid.AddProperty(propertyName, editorType, _arrayProperty.ReadOnly);
            label.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(56)))), ((int)(((byte)(56)))), ((int)(((byte)(56)))));
            label.MouseClick += new MouseEventHandler(label_MouseClick);

            DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;

            if (Plugin.IsCustomClassType(_arrayProperty.ItemType)) {
                editor.SetStructProperty(new DesignerStructPropertyInfo(
                                             _arrayProperty.ItemType.Name, _arrayProperty.ItemType, _arrayProperty.ItemList[itemIndex], itemIndex),
                                         _object);

            } else {
                DesignerArrayPropertyInfo arrayProperty = new DesignerArrayPropertyInfo(_arrayProperty);
                arrayProperty.ItemIndex = itemIndex;

                editor.SetArrayProperty(arrayProperty, _object);
            }

            editor.ValueWasAssigned();
            editor.ValueWasChanged += editor_ValueWasChanged;

            if (isSelected)
            { selectLabel(label); }
        }
Beispiel #19
0
 public DesignerArrayPropertyInfo(DesignerArrayPropertyInfo arrayProperty)
 {
     _name = arrayProperty.Name;
     _itemType = arrayProperty.ItemType;
     _itemList = arrayProperty.ItemList;
     _itemIndex = arrayProperty.ItemIndex;
     _readOnly = arrayProperty.ReadOnly;
 }
 public virtual void SetArrayProperty(DesignerArrayPropertyInfo arrayProperty, object obj)
 {
     _arrayProperty = arrayProperty;
     _object = obj;
 }