CA-248353: Reference the column object directly instead of trying to retrieve it using a hardcoded string as a key.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-05-01 13:52:09 +01:00 committed by Mihaela Stoica
parent 0d8f61fbb0
commit 79684617eb
2 changed files with 7 additions and 10 deletions

View File

@ -38,7 +38,6 @@ using XenAdmin.Actions;
using XenAdmin.Commands;
using XenAdmin.Controls;
using XenAdmin.Core;
using XenAdmin.SettingsPanels;
using XenAPI;
namespace XenAdmin.Wizards.GenericPages
@ -58,7 +57,7 @@ namespace XenAdmin.Wizards.GenericPages
label1.Text = string.Format(Helpers.IsPool(_pool.Connection) ? Messages.VMS_IN_POOL : Messages.VMS_IN_SERVER,
_pool.Name().Ellipsise(60));
label2.Text = VMGroup<T>.ChooseVMsPage_Rubric;
dataGridView1.Columns["ColumnCurrentGroup"].HeaderText = VMGroup<T>.ChooseVMsPage_CurrentGroup;
ColumnCurrentGroup.HeaderText = VMGroup<T>.ChooseVMsPage_CurrentGroup;
}
}

View File

@ -166,19 +166,18 @@ namespace XenAdmin.Wizards.ImportWizard
private void SetNetworkList()
{
DataGridViewComboBoxColumn col = (DataGridViewComboBoxColumn)m_networkGridView.Columns["NetworkNetworkColumn"];
col.Items.Clear();
NetworkNetworkColumn.Items.Clear();
var networks = m_selectedConnection.Cache.Networks.Where(ShowNetwork);
foreach (XenAPI.Network network in networks)
{
col.Items.Add(new ToStringWrapper<XenAPI.Network>(network, network.Name()));
NetworkNetworkColumn.Items.Add(new ToStringWrapper<XenAPI.Network>(network, network.Name()));
}
col.DisplayMember = ToStringWrapper<XenAPI.Network>.DisplayMember;
col.ValueMember = ToStringWrapper<XenAPI.Network>.ValueMember;
col.Sorted = true;
NetworkNetworkColumn.DisplayMember = ToStringWrapper<XenAPI.Network>.DisplayMember;
NetworkNetworkColumn.ValueMember = ToStringWrapper<XenAPI.Network>.ValueMember;
NetworkNetworkColumn.Sorted = true;
}
private void BuildVIFList()
@ -312,8 +311,7 @@ namespace XenAdmin.Wizards.ImportWizard
if (network == null)
return null;
DataGridViewComboBoxColumn column = (DataGridViewComboBoxColumn)m_networkGridView.Columns["NetworkNetworkColumn"];
foreach (ToStringWrapper<XenAPI.Network> entry in column.Items)
foreach (ToStringWrapper<XenAPI.Network> entry in NetworkNetworkColumn.Items)
{
if (entry.item.uuid == network.uuid)
return entry;