Exemplo n.º 1
0
        private void updateList()
        {
            PIFRow selected = null;

            if (dataGridView1.SelectedRows.Count > 0)
            {
                selected = dataGridView1.SelectedRows[0] as PIFRow;
            }

            try
            {
                dataGridView1.SuspendLayout();
                dataGridView1.Rows.Clear();

                if (host != null)
                {
                    foreach (PIF PIF in host.Connection.ResolveAll(host.PIFs))
                    {
                        if (!PIF.IsPhysical())
                        {
                            continue;
                        }

                        RegisterPIFEventHandlers(PIF);

                        PIFRow p = new PIFRow(PIF);
                        dataGridView1.Rows.Add(p);
                        if (selected != null && p.Pif == selected.Pif)
                        {
                            p.Selected = true;
                        }
                    }

                    //show the FCoE column for Dundee or higher hosts only
                    ColumnFCoECapable.Visible = Helpers.DundeeOrGreater(host);

                    //show the SR-IOV column for Kolkata or higher hosts only
                    ColumnSriovCapable.Visible = Helpers.KolkataOrGreater(host);

                    HelpersGUI.ResizeGridViewColumnToHeader(ColumnDeviceName);
                    HelpersGUI.ResizeGridViewColumnToHeader(ColumnSriovCapable);

                    if (dataGridView1.SortedColumn != null)
                    {
                        dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending);
                    }
                }
            }
            finally
            {
                dataGridView1.ResumeLayout();
            }
        }