Example #1
0
        protected void Init(Int32 width, Int32 height)
        {
            Cells = new List <List <SourceTableCell> >();

            if (width < 1 || height < 1)
            {
                return;
                //
            }


            for (int i = 0; i < height; i++)
            {
                List <SourceTableCell> row = new List <SourceTableCell>();

                for (int j = 0; j < width; j++)
                {
                    SourceTableCell cell = new SourceTableCell();

                    row.Add(cell);
                }

                Cells.Add(row);
            }
        }
Example #2
0
 public void SetCell(Int32 x, Int32 y, SourceTableCell cell)
 {
     if (checkCoordinates(x, y))
     {
         Cells[y][x] = cell;
     }
     else
     {
     }
 }
Example #3
0
 /// <summary>
 /// Gets cell at given coordinates. If cell does not exist, returns null
 /// </summary>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <returns></returns>
 public SourceTableCell GetCell(Int32 x, Int32 y)
 {
     if (checkCoordinates(x, y))
     {
         SourceTableCell output = Cells[y][x];
         return(output);
     }
     else
     {
         return(null);
     }
 }
Example #4
0
        /// <summary>
        /// Gets the value. If cell does not exist, returns default value for {T}
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="x">The x - index of column</param>
        /// <param name="y">The y - index of row</param>
        /// <returns></returns>
        public T GetValue <T>(Int32 x, Int32 y)
        {
            SourceTableCell output = GetCell(x, y);

            if (output != null)
            {
                return(output.Value.imbConvertValueSafeTyped <T>());
            }
            else
            {
                return(default(T));
            }
        }
Example #5
0
        public List <List <String> > GetContentByRows()
        {
            List <List <String> > output = new List <List <string> >();

            for (int i = 0; i < Height; i++)
            {
                List <String> row = new List <string>();
                for (int j = 0; j < Width; j++)
                {
                    SourceTableCell cell = GetCell(j, i);
                    row.Add(cell.Value);
                }
                output.Add(row);
            }
            return(output);
        }
Example #6
0
        public List <List <String> > GetContentByColumns()
        {
            List <List <String> > output = new List <List <string> >();

            for (int i = 0; i < Width; i++)
            {
                List <String> column = new List <string>();
                for (int j = 0; j < Height; j++)
                {
                    SourceTableCell cell = GetCell(i, j);
                    column.Add(cell.Value);
                }
                output.Add(column);
            }
            return(output);
        }