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); //CA-47050: the Device column should be autosized to Fill, but should not become smaller than a minimum //width, which here is chosen to be the column header width. To find what this width is //set temporarily the column's autosize mode to ColumnHeader. ColumnDeviceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; int storedWidth = ColumnDeviceName.Width; ColumnDeviceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ColumnDeviceName.MinimumWidth = storedWidth; if (dataGridView1.SortedColumn != null) { dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } } } finally { dataGridView1.ResumeLayout(); } }
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(); } }
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; } } //CA-47050: the ColumnBusPath should be autosized to Fill, but should not become smaller than a minimum //width, which is chosen to be the column's contents (including header) width. To find what this is //set temporarily the column's autosize mode to AllCells. ColumnBusPath.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; int storedWidth = ColumnBusPath.Width; ColumnBusPath.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ColumnBusPath.MinimumWidth = storedWidth; if (dataGridView1.SortedColumn != null) { dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } } } finally { dataGridView1.ResumeLayout(); } }
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; PIFRow p = new PIFRow(PIF); dataGridView1.Rows.Add(p); if (selected != null && p.pif == selected.pif) p.Selected = true; } //CA-47050: the ColumnBusPath should be autosized to Fill, but should not become smaller than a minimum //width, which is chosen to be the column's contents (including header) width. To find what this is //set temporarily the column's autosize mode to AllCells. ColumnBusPath.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; int storedWidth = ColumnBusPath.Width; ColumnBusPath.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ColumnBusPath.MinimumWidth = storedWidth; if (dataGridView1.SortedColumn != null) dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } } finally { dataGridView1.ResumeLayout(); } }
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); //CA-47050: the Device column should be autosized to Fill, but should not become smaller than a minimum //width, which here is chosen to be the column header width. To find what this width is //set temporarily the column's autosize mode to ColumnHeader. ColumnDeviceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; int storedWidth = ColumnDeviceName.Width; ColumnDeviceName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ColumnDeviceName.MinimumWidth = storedWidth; if (dataGridView1.SortedColumn != null) dataGridView1.Sort(dataGridView1.SortedColumn, dataGridView1.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); } } finally { dataGridView1.ResumeLayout(); } }