Пример #1
0
        /// <inheritdoc />
        protected override void OnCurrentTypeChanged()
        {
            base.OnCurrentTypeChanged();

            if (_defaultValueEditor != null && !_editor.IsValid(this, _defaultValueEditor))
            {
                _defaultValueEditor.Dispose();
                _defaultValueEditor = null;
                _editor             = null;
            }

            if (Connections.Count == 0)
            {
                CreateDefaultEditor();
            }
        }
Пример #2
0
        /// <summary>
        /// Creates the default value editor control.
        /// </summary>
        private void CreateDefaultEditor()
        {
            if (_defaultValueEditor != null || Archetype.ValueIndex == -1)
            {
                return;
            }

            for (int i = 0; i < DefaultValueEditors.Count; i++)
            {
                if (DefaultValueEditors[i].CanUse(this, ref _currentType))
                {
                    var bounds = new Rectangle(X + Width + 8 + Style.Current.FontSmall.MeasureText(Text).X, Y, 90, Height);
                    _editor             = DefaultValueEditors[i];
                    _defaultValueEditor = _editor.Create(this, ref bounds);
                    if (_attributes != null)
                    {
                        _editor.UpdateAttributes(this, _attributes, _defaultValueEditor);
                    }
                    break;
                }
            }
        }