public override void PopulatePage() { m_dataGridView.Rows.Clear(); SetButtonNextEnabled(true); FillTableRows(); HelpersGUI.ResizeLastGridViewColumn(m_colTargetNet);//set properly the width of the last column }
public override void PopulatePage() { if (SummaryRetreiver == null) { return; } var entries = SummaryRetreiver.Invoke(); m_dataGridView.Rows.Clear(); panelErrorsFound.Visible = false; foreach (var pair in entries) { var row = new DataGridViewRow(); DataGridViewTextBoxCell valueCell = new DataGridViewTextBoxCell() { Value = pair.Value }; if (pair.Errors) { valueCell.Style.Font = new Font(m_dataGridView.Font, FontStyle.Bold); panelErrorsFound.Visible = true; } row.Cells.AddRange(new DataGridViewTextBoxCell { Value = pair.Key }, valueCell); m_dataGridView.Rows.Add(row); } HelpersGUI.ResizeLastGridViewColumn(Column2);//set properly the width of the last column }
public override void PopulatePage() { if (templatesOnly) { if (selectionCount > 1) { m_labelIntro.Text = Messages.CPM_WIZARD_FINISH_PAGE_INTRO_COPY_TEMPLATE; } else { m_labelIntro.Text = Messages.CPM_WIZARD_FINISH_PAGE_INTRO_COPY_SINGLE_TEMPLATE; } } else { if (selectionCount > 1) { m_labelIntro.Text = wizardMode == WizardMode.Copy ? Messages.CPM_WIZARD_FINISH_PAGE_INTRO_COPY : Messages.CPM_WIZARD_FINISH_PAGE_INTRO; } else { m_labelIntro.Text = wizardMode == WizardMode.Copy ? Messages.CPM_WIZARD_FINISH_PAGE_INTRO_COPY_SINGLE : Messages.CPM_WIZARD_FINISH_PAGE_INTRO_SINGLE; } } if (SummaryRetreiver == null) { return; } var entries = SummaryRetreiver.Invoke(); m_dataGridView.Rows.Clear(); panelErrorsFound.Visible = false; foreach (var pair in entries) { var row = new DataGridViewRow(); DataGridViewTextBoxCell valueCell = new DataGridViewTextBoxCell() { Value = pair.Value }; if (pair.Errors) { valueCell.Style.Font = new Font(m_dataGridView.Font, FontStyle.Bold); panelErrorsFound.Visible = true; } row.Cells.AddRange(new DataGridViewTextBoxCell { Value = pair.Key }, valueCell); m_dataGridView.Rows.Add(row); } HelpersGUI.ResizeLastGridViewColumn(Column2);//set properly the width of the last column }
public override void PopulatePage() { if (SummaryRetreiver == null) { return; } var entries = SummaryRetreiver.Invoke(); m_dataGridView.Rows.Clear(); foreach (var pair in entries) { var row = new DataGridViewRow(); row.Cells.AddRange(new DataGridViewTextBoxCell { Value = pair.Key }, new DataGridViewTextBoxCell { Value = pair.Value }); m_dataGridView.Rows.Add(row); } HelpersGUI.ResizeLastGridViewColumn(Column2);//set properly the width of the last column }
private void BuildList() { Program.AssertOnEventThread(); if (!this.Visible) { return; } try { dataGridViewStorage.SuspendLayout(); DataGridViewSelectedRowCollection vbdSavedItems = dataGridViewStorage.SelectedRows; dataGridViewStorage.Rows.Clear(); if (vm == null) { return; } bool storageLinkColumnVisible = false; List <bool> devices_in_use = new List <bool>(); foreach (VBD vbd in vm.Connection.ResolveAll(vm.VBDs)) { vbd.PropertyChanged -= new PropertyChangedEventHandler(vbd_PropertyChanged); vbd.PropertyChanged += new PropertyChangedEventHandler(vbd_PropertyChanged); if (!vbd.IsCDROM && !vbd.IsFloppyDrive) { VDI vdi = vm.Connection.Resolve(vbd.VDI); if (vdi == null || !vdi.Show(Properties.Settings.Default.ShowHiddenVMs)) { continue; } SR sr = vm.Connection.Resolve(vdi.SR); if (sr == null || sr.IsToolsSR) { continue; } storageLinkColumnVisible = vdi.sm_config.ContainsKey("SVID"); vdi.PropertyChanged -= new PropertyChangedEventHandler(vdi_PropertyChanged); vdi.PropertyChanged += new PropertyChangedEventHandler(vdi_PropertyChanged); dataGridViewStorage.Rows.Add(new VBDRow(vbd, vdi, sr)); int i; if (int.TryParse(vbd.userdevice, out i)) { while (devices_in_use.Count <= i) { devices_in_use.Add(false); } devices_in_use[i] = true; } } //CA-47050: the dnsColumn 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. HelpersGUI.ResizeLastGridViewColumn(ColumnDevicePath); } storageLinkColumn.Visible = storageLinkColumnVisible; dataGridViewStorage.Sort(dataGridViewStorage.SortedColumn, dataGridViewStorage.SortOrder == SortOrder.Ascending ? ListSortDirection.Ascending : ListSortDirection.Descending); IEnumerable <VBD> vbdsSelected = from VBDRow row in vbdSavedItems select row.VBD; foreach (VBDRow row in dataGridViewStorage.Rows) { row.Selected = vbdsSelected.Contains(row.VBD); } } catch (Exception e) { log.ErrorFormat("Exception building VM storage list: {0}", e.Message); } finally { dataGridViewStorage.ResumeLayout(); } UpdateButtons(); }
public override void PopulatePage() { m_totalSpaceRequired = 0; m_dataGridView.Rows.Clear(); m_ctrlError.HideError(); bool checkSpaceRequirements = true; var targetRefs = new List <object>(); foreach (var mapping in m_vmMappings.Values.Where(mapping => !targetRefs.Contains(mapping.XenRef))) { targetRefs.Add(mapping.XenRef); } var commonSRs = new List <ToStringWrapper <SR> >(); foreach (var kvp in m_vmMappings) { string sysId = kvp.Key; var vmMapping = kvp.Value; int i = 0; foreach (IStorageResource resourceData in ResourceData(sysId)) { if (!resourceData.CanCalculateDiskCapacity) { continue; } m_totalSpaceRequired += resourceData.RequiredDiskCapacity; string disklabel = !string.IsNullOrEmpty(resourceData.DiskLabel) ? string.Format("{0} - {1}", vmMapping.VmNameLabel, resourceData.DiskLabel) : string.Format("{0} - {1} {2}", vmMapping.VmNameLabel, Messages.STORAGE_DISK, i); var cellVmDisk = new DataGridViewTextBoxCell { Tag = new StorageDetail { RequiredSpace = resourceData.RequiredDiskCapacity, SysId = sysId }, Value = FormatDiskValueText(resourceData, disklabel) }; DataGridViewRow row = new DataGridViewRow(); row.Cells.AddRange(cellVmDisk); var cb = FillGridComboBox(vmMapping.XenRef, targetRefs, resourceData, ref commonSRs); if (cb.Items.Count > 0) { cb.DisplayMember = ToStringWrapper <SR> .DisplayMember; cb.ValueMember = ToStringWrapper <SR> .ValueMember; if (cb.Value == null) { cb.Value = cb.Items[0]; } cb.Tag = resourceData.Tag; row.Cells.Add(cb); } else { var cellError = new DataGridViewTextBoxCell { Value = Messages.IMPORT_SELECT_STORAGE_PAGE_ERROR_NO_SR_AVAILABLE }; row.Cells.Add(cellError); cellError.ReadOnly = true; //this has to be set after the cell is added to a row SetButtonNextEnabled(false); checkSpaceRequirements = false; } m_dataGridView.Rows.Add(row); i++; } } HelpersGUI.ResizeLastGridViewColumn(m_colStorage);//set properly the width of the last column m_comboBoxSr.Items.Clear(); PopulateSrComboBox(commonSRs); if (m_comboBoxSr.Items.Count == 0) { m_comboBoxSr.Items.Add(Messages.IMPORT_SELECT_STORAGE_PAGE_ERROR_NO_COMMON_SR_AVAILABLE); SetButtonNextEnabled(false); checkSpaceRequirements = false; m_radioSpecifySr.Checked = true; } else { m_radioAllOnSameSr.Checked = true; } m_comboBoxSr.SelectedItem = m_comboBoxSr.Items[DetermineDefaultSrPositionInComboBox()]; if (checkSpaceRequirements) { PerformCheck(CheckStorageRequirements); } }
private void PopulateDataGridView(IEnableableXenObjectComboBoxItem selectedItem) { Program.AssertOnEventThread(); updatingHomeServerList = true; try { Connection = null; var target = m_comboBoxConnection.SelectedItem as DelayLoadingOptionComboBoxItem; if (target != null) { Connection = target.Item.Connection; } ClearDataGridView(); SetButtonNextEnabled(true); var hasPoolSharedStorage = HasPoolSharedStorage(); foreach (var kvp in m_vmMappings) { var tb = new DataGridViewTextBoxCell { Value = kvp.Value.VmNameLabel, Tag = kvp.Key }; var cb = new DataGridViewEnableableComboBoxCell { FlatStyle = FlatStyle.Flat }; List <ReasoningFilter> homeserverFilters = CreateTargetServerFilterList( selectedItem, new List <String> { kvp.Key }); if (Connection != null) { if (hasPoolSharedStorage) { foreach (var pool in Connection.Cache.Pools) { var item = new NoTargetServerPoolItem(pool); cb.Items.Add(item); if ((m_selectedObject != null && m_selectedObject.opaque_ref == pool.opaque_ref) || (target != null && target.Item.opaque_ref == pool.opaque_ref)) { cb.Value = item; } break; //there exists one pool per connection } } var sortedHosts = new List <Host>(Connection.Cache.Hosts); sortedHosts.Sort(); var items = new List <DelayLoadingOptionComboBoxItem>(); foreach (var host in sortedHosts) { var item = new DelayLoadingOptionComboBoxItem(host, homeserverFilters); item.LoadAndWait(); cb.Items.Add(item); if (item.Enabled && ((m_selectedObject != null && m_selectedObject.opaque_ref == host.opaque_ref) || (target != null && target.Item.opaque_ref == host.opaque_ref))) { cb.Value = item; } } } SetComboBoxPreSelection(cb); var row = new DataGridViewRow(); row.Cells.AddRange(tb, cb); m_dataGridView.Rows.Add(row); } HelpersGUI.ResizeLastGridViewColumn(m_colTarget); //set properly the width of the last column if (restoreGridHomeServerSelection) { RestoreGridHomeServerSelectionFromMapping(); restoreGridHomeServerSelection = false; } } finally { updatingHomeServerList = false; } }
public void Expand() { ValueColumn.MinimumWidth = 5; HelpersGUI.ResizeLastGridViewColumn(ValueColumn); ToggleExpandedState(true); }