Exemplo n.º 1
0
        // Reading from XML onProgramStart and rendering existing tables in UI
        public void readAndAdd(List <Table> list = null, Panel overlay = null)
        {
            Table table = new Table();

            Read_write_xml.Read();                              // Getting list of tables and store it in Mgbox
            MgBox.positionY = 10;
            List <Table> tableList     = list ?? MgBox.tableList;
            Panel        placeToRender = overlay ?? tbl_list_panel;

            if (placeToRender == overlay)
            {
                tbl_list_panel.Visible = false;
                overlay.Visible        = true;
            }

            placeToRender.Controls.Clear();

            if (tableList.Any())
            {
                for (int i = 0; i < tableList.Count; i++)       // If list is not emty - loop trough list and render each table in UI
                {
                    table = tableList[i];
                    table.Create(
                        table.Name,
                        table.Number,
                        table.Id,
                        table.Path_lxd,
                        table.Tbl_ip,
                        MgBox.positionY);

                    placeToRender.Controls.Add(table.GetPanel());

                    MgBox.positionY += 30;
                }
            }
        }