Merge pull request #1503 from letsboogey/gpu

CP-21558 - On the vGPU types dialog, hide the column headers where al…
This commit is contained in:
Gabor Apati-Nagy 2017-03-28 10:54:54 +01:00 committed by GitHub
commit 3a83bba457

View File

@ -102,6 +102,8 @@ namespace XenAdmin.Controls.GPU
.ToArray()); .ToArray());
} }
SetCheckedValues(); SetCheckedValues();
HideColumnIfEmpty(MaxResolutionColumn);
HideColumnIfEmpty(MaxDisplaysColumn);
} }
finally finally
{ {
@ -153,6 +155,22 @@ namespace XenAdmin.Controls.GPU
? Messages.GPU_RUBRIC_PLEASE_SELECT_WHICH_GPU_ONE ? Messages.GPU_RUBRIC_PLEASE_SELECT_WHICH_GPU_ONE
: Messages.GPU_RUBRIC_PLEASE_SELECT_WHICH_GPU_MULTIPLE; : Messages.GPU_RUBRIC_PLEASE_SELECT_WHICH_GPU_MULTIPLE;
} }
private void HideColumnIfEmpty(DataGridViewColumn column)
{
bool columnEmpty = true;
foreach (DataGridViewRow row in dataGridViewEx1.Rows)
{
var value = row.Cells[column.Name].Value;
if (!String.IsNullOrEmpty((string)value))
{
columnEmpty = false;
break;
}
}
if (columnEmpty)
dataGridViewEx1.Columns[column.Name].Visible = false;
}
} }
class VGpuDetailWithCheckBoxRow : DataGridViewExRow class VGpuDetailWithCheckBoxRow : DataGridViewExRow