Exemplo n.º 1
0
        // Constructor for a non-fixed, defined field
        //mxd. Also for a user variable field.
        public FieldsEditorRow(DataGridView view, string name, int type, object value, bool isuservar)
        {
            //mxd. Row type
            this.rowtype = (isuservar ? FieldsEditorRowType.USERVAR : FieldsEditorRowType.DYNAMIC);

            // Type
            this.fieldtype = General.Types.GetFieldHandler(type, value);

            // Make all cells
            base.CreateCells(view);

            //mxd. Our path splits here...
            if (isuservar)
            {
                // Not defined
                this.DefaultCellStyle.ForeColor = SystemColors.GrayText;
                isdefined = false;
                fieldtype.ApplyDefaultValue();

                // Setup property cell
                this.Cells[0].Value    = name;
                this.Cells[0].ReadOnly = true;

                // Setup type cell
                this.Cells[1].Value    = fieldtype.GetDisplayType();
                this.Cells[1].ReadOnly = true;

                // Setup value cell
                this.Cells[2].Value = fieldtype.GetStringValue();
            }
            else
            {
                // Defined
                this.DefaultCellStyle.ForeColor = SystemColors.WindowText;
                isdefined = true;

                // Setup property cell
                this.Cells[0].Value    = name;
                this.Cells[0].ReadOnly = true;

                // Setup type cell
                this.Cells[1].Value    = fieldtype.GetDisplayType();
                this.Cells[1].ReadOnly = false;

                // Setup value cell
                this.Cells[2].Value = fieldtype.GetStringValue();
            }

            // We have no destructor
            GC.SuppressFinalize(this);
        }
Exemplo n.º 2
0
        // Constructor for a fixed, undefined field
        public FieldsEditorRow(DataGridView view, UniversalFieldInfo fixedfield)
        {
            // Undefined
            this.DefaultCellStyle.ForeColor = SystemColors.GrayText;
            isdefined = false;

            // Fixed
            this.fieldinfo = fixedfield;
            this.rowtype   = FieldsEditorRowType.FIXED;           //mxd

            // Type
            this.fieldtype = General.Types.GetFieldHandler(fixedfield);

            // Make all cells
            base.CreateCells(view);

            // Setup property cell
            this.Cells[0].Value    = fixedfield.Name;
            this.Cells[0].ReadOnly = true;

            // Setup type cell
            this.Cells[1].Value    = fieldtype.GetDisplayType();
            this.Cells[1].ReadOnly = true;

            // Setup value cell
            this.Cells[2].Value = fieldtype.GetStringValue();

            // We have no destructor
            GC.SuppressFinalize(this);
        }
Exemplo n.º 3
0
        // Constructor for a non-fixed, defined field
        public FieldsEditorRow(DataGridView view, string name, int type, object value)
        {
            // Defined
            this.DefaultCellStyle.ForeColor = SystemColors.WindowText;
            isdefined = true;

            // Non-fixed
            isfixed = false;

            // Type
            this.fieldtype = General.Types.GetFieldHandler(type, value);

            // Make all cells
            base.CreateCells(view);

            // Setup property cell
            this.Cells[0].Value    = name;
            this.Cells[0].ReadOnly = true;

            // Setup type cell
            this.Cells[1].Value    = fieldtype.GetDisplayType();
            this.Cells[1].ReadOnly = false;

            // Setup value cell
            this.Cells[2].Value = fieldtype.GetStringValue();

            // We have no destructor
            GC.SuppressFinalize(this);
        }
Exemplo n.º 4
0
        // This changes the type
        public void ChangeType(int typeindex)
        {
            // Can't do this for a fixed field!
            if (rowtype == FieldsEditorRowType.FIXED)
            {
                throw new InvalidOperationException();
            }

            // Different?
            if (typeindex != fieldtype.Index)
            {
                // Change field type!
                fieldtype           = General.Types.GetFieldHandler(typeindex, this.Cells[2].Value);
                this.Cells[1].Value = fieldtype.GetDisplayType();
            }
        }
Exemplo n.º 5
0
        // This changes the type
        public void ChangeType(int typeindex)
        {
            // Can't do this for a fixed field!
            if (isfixed)
            {
                throw new InvalidOperationException();
            }

            // Different?
            if (typeindex != fieldtype.Index)
            {
                // Change field type!
                TypeHandlerAttribute attrib = General.Types.GetAttribute(typeindex);
                fieldtype           = General.Types.GetFieldHandler(typeindex, this.Cells[2].Value);
                this.Cells[1].Value = fieldtype.GetDisplayType();
            }
        }