Ejemplo n.º 1
0
        public AdditionalFieldsControl()
        {
            InitializeComponent();

            PlugInManager compMan    = new PlugInManager();
            var           autoFields = compMan.GetPlugins(Plugins.Type.IAutoField);

            if (autoFields != null)
            {
                tablePanel.RowCount = autoFields.Count();
                tablePanel.Height   = autoFields.Count() * 25;
                tablePanel.Resize  += new EventHandler(tablePanel_Resize);

                int row = 0;
                foreach (var compType in autoFields)
                {
                    IAutoField aField = compMan.CreateInstance <IAutoField>(compType);
                    if (aField == null)
                    {
                        continue;
                    }

                    TextBox           box      = new TextBox();
                    AutoFieldCheckBox checkBox = new AutoFieldCheckBox(aField, box);

                    box.Text = aField.AutoFieldPrimayName;

                    tablePanel.Controls.Add(checkBox, 0, row);
                    tablePanel.Controls.Add(box, 1, row++);
                }
            }
        }
Ejemplo n.º 2
0
        public AutoFieldCheckBox(IAutoField field, TextBox nameBox)
        {
            if (field == null || nameBox == null)
            {
                return;
            }

            _field   = field;
            _nameBox = nameBox;

            this.Text = _field.AutoFieldName;

            if (_field.AutoFieldDescription != String.Empty)
            {
                this.Text += (": " + _field.AutoFieldDescription);
            }

            _nameBox.TextChanged += new EventHandler(nameBox_TextChanged);
        }