Exemplo n.º 1
0
        public override void PopulatePage()
        {
            var external = SelectedNetworkType == NetworkTypes.External;

            labelExternal.Visible   = external;
            labelInternal.Visible   = !external;
            labelNIC.Visible        = external;
            comboBoxNICList.Visible = external;

            if (comboBoxNICList.Visible)
            {
                try
                {
                    _populatingNics = true;
                    comboBoxNICList.Items.Clear();

                    foreach (PIF ThePIF in Connection.Cache.PIFs)
                    {
                        if (ThePIF.host.opaque_ref == Host.opaque_ref && ThePIF.IsPhysical() &&
                            (Properties.Settings.Default.ShowHiddenVMs || ThePIF.Show(Properties.Settings.Default.ShowHiddenVMs)) &&
                            !ThePIF.IsBondSlave())
                        {
                            comboBoxNICList.Items.Add(ThePIF);
                        }
                    }
                }
                finally
                {
                    _populatingNics = false;
                }

                if (comboBoxNICList.Items.Count > 0)
                {
                    comboBoxNICList.SelectedIndex = 0;
                }

                comboBoxNICList.Focus();
            }

            labelVLAN.Visible         = external;
            numericUpDownVLAN.Visible = external;
            numericUpDownVLAN.Minimum = Helpers.VLAN0Allowed(Connection) ? 0 : 1;
            numericUpDownMTU.Visible  = labelMTU.Visible = infoMtuPanel.Visible = external;

            checkBoxSriov.Visible = SelectedHostNic != null && SelectedHostNic.IsSriovPhysicalPIF();

            OnPageUpdated();
        }
Exemplo n.º 2
0
        private void PopulateHostNicList(Host host, IXenConnection conn)
        {
            comboBoxNICList.Items.Clear();

            foreach (PIF ThePIF in conn.Cache.PIFs)
            {
                if (ThePIF.host.opaque_ref == host.opaque_ref && ThePIF.IsPhysical() && (Properties.Settings.Default.ShowHiddenVMs || ThePIF.Show(Properties.Settings.Default.ShowHiddenVMs)) && !ThePIF.IsBondSlave())
                {
                    comboBoxNICList.Items.Add(ThePIF);
                }
            }
            if (comboBoxNICList.Items.Count > 0)
            {
                comboBoxNICList.SelectedIndex = 0;
            }

            cmbHostNicList_SelectedIndexChanged(null, null);
        }