Пример #1
0
        private async void UpdateTables()
        {
            var tables = await apiNetwork.GetAllTable();

            if (tables != null)
            {
                allTable = tables;

                foreach (TableItem item in tables)
                {
                    TableCardCell cell = (tableList.Controls.Find(Name = item.id.ToString(), true).First() as TableCardCell);
                    cell.SetTable(item);
                }
            }
        }
Пример #2
0
        private async void LoadData()
        {
            var tables = await apiNetwork.GetAllTable();

            if (tables != null)
            {
                allTable = tables;

                tableList.Controls.Clear();

                tableList.ColumnStyles.Clear();
                tableList.RowStyles.Clear();
                var rowCount = tables.Count % 5 > 0 ? (tables.Count / 5) + 1 : tables.Count / 5;

                tableList.ColumnCount = 5;
                tableList.RowCount    = rowCount;

                var index = 0;

                for (int y = 0; y < rowCount; y++)
                {
                    //Next, add a row.  Only do this when once, when creating the first column
                    var row = new RowStyle(SizeType.Absolute)
                    {
                        Height = 150
                    };
                    tableList.RowStyles.Add(row);
                    for (int x = 0; x < 5; x++)
                    {
                        var columns = new ColumnStyle(SizeType.Percent)
                        {
                            Width = 20
                        };
                        tableList.ColumnStyles.Add(columns);
                        //item
                        var           table = tables[index];
                        TableCardCell item  = new TableCardCell()
                        {
                            Name = table.id.ToString()
                        };
                        item.SetTable(table);

                        index++;
                        tableList.Controls.Add(item, x, y);
                    }
                }
            }
        }