Represents a row from array view.
Inheritance: ICustomTypeDescriptor, IEditableObject, IDataErrorInfo
Esempio n. 1
0
        /// <summary>
        ///   Initializes a new ArrayDataView from array.
        /// </summary>
        ///
        /// <param name="array">array of data.</param>
        ///
        public ArrayDataView(Array array)
        {
            if (array.Rank > 2)
            {
                throw new ArgumentException("Supports only up to two dimentional arrays", "array");
            }

            this.data = array;

            if (array.Rank == 2)
            {
                rowCount = array.GetLength(0);
                colCount = array.GetLength(1);
                type     = ArrayDataType.Multidimensional;

                rows = new ArrayRowView[rowCount];

                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i] = new ArrayRowView(this, i);
                }
            }
            else
            {
                rowCount = 1;
                colCount = array.GetLength(0);
                rows     = new ArrayRowView[] { new ArrayRowView(this, 0) };
                type     = ArrayDataType.Simple;
            }
        }
        /// <summary>
        ///   Sets a value to the array.
        /// </summary>
        ///
        public override void SetValue(object component, object value)
        {
            ArrayRowView rowView = component as ArrayRowView;

            if (rowView != null)
            {
                rowView.SetColumnValue(columnIndex, value);
            }
        }
        /// <summary>
        /// Initializes a new ArrayDataView from array.
        /// </summary>
        /// <param name="array">array of data.</param>
        public ArrayDataView(Array array)
        {
            if (array.Rank > 2)
                throw new ArgumentException("Supports only up to two dimentional arrays", "array");

            this.data = array;

            if (array.Rank == 2)
            {
                rows = new ArrayRowView[array.GetLength(0)];

                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i] = new ArrayRowView(this, i);
                }
            }
            else
            {
                rows = new ArrayRowView[] { new ArrayRowView(this, 0) };
            }
        }
        /// <summary>
        /// Initializes a new ArrayDataView from array.
        /// </summary>
        /// <param name="array">array of data.</param>
        public ArrayDataView(Array array)
        {
            if (array.Rank > 2)
            {
                throw new ArgumentException("Supports only up to two dimentional arrays", "array");
            }

            this.data = array;

            if (array.Rank == 2)
            {
                rows = new ArrayRowView[array.GetLength(0)];

                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i] = new ArrayRowView(this, i);
                }
            }
            else
            {
                rows = new ArrayRowView[] { new ArrayRowView(this, 0) };
            }
        }
Esempio n. 5
0
        /// <summary>
        ///   Initializes a new ArrayDataView from array.
        /// </summary>
        /// 
        /// <param name="array">array of data.</param>
        /// 
        public ArrayDataView(Array array)
        {
            if (array.Rank > 2)
                throw new ArgumentException("Supports only up to two dimensional arrays", "array");

            this.data = array;

            if (array.Rank == 2)
            {
                rowCount = array.GetLength(0);
                colCount = array.GetLength(1);
                type = ArrayDataType.Multidimensional;
            }
            else
            {
                if (array.GetValue(0) is Array)
                {
                    Array row = array.GetValue(0) as Array;

                    rowCount = array.GetLength(0);
                    colCount = row.GetLength(0);
                    type = ArrayDataType.Jagged;
                }
                else
                {
                    rowCount = 1;
                    colCount = array.GetLength(0);
                    type = ArrayDataType.Simple;
                }
            }

            rows = new ArrayRowView[rowCount];
            for (int i = 0; i < rows.Length; i++)
                rows[i] = new ArrayRowView(this, i);
        }