private void addButton_Click(object sender, EventArgs e) { using (var dialog = new AddVGPUDialog(vm, VGpus)) { if (dialog.ShowDialog() == DialogResult.OK) { var tuple = dialog.SelectedTuple; if (tuple == null) { return; } VGPU_type type = tuple.VgpuTypes[0]; // Set vGPU device to null. vGPU creation will check whether a valid device is assigned // to the vGPU, if not then 0 is used to declare the first availabe slot in VM var vGpu = new VGPU(); vGpu.device = null; vGpu.GPU_group = new XenRef <GPU_group>(tuple.GpuGroup.opaque_ref); vGpu.type = new XenRef <VGPU_type>(type.opaque_ref); vGpu.Connection = vm.Connection; gpuGrid.Rows.Add(new VGpuDetailRow(vGpu)); warningsTable.SuspendLayout(); ShowHideWarnings(); warningsTable.ResumeLayout(); } } }
private void addButton_Click(object sender, EventArgs e) { using (var dialog = new AddVGPUDialog(vm, VGpus)) { if (dialog.ShowDialog() == DialogResult.OK) { var tuple = dialog.SelectedTuple; if (tuple == null) { return; } VGPU_type type = tuple.VgpuTypes[0]; var vGpu = new VGPU(); vGpu.GPU_group = new XenRef <GPU_group>(tuple.GpuGroup.opaque_ref); vGpu.type = new XenRef <VGPU_type>(type.opaque_ref); vGpu.Connection = vm.Connection; gpuGrid.Rows.Add(new VGpuDetailRow(vGpu)); warningsTable.SuspendLayout(); ShowHideWarnings(); warningsTable.ResumeLayout(); } } }