示例#1
0
        public void PopulateComboBox(IXenConnection connection, Func <NetworkComboBoxItem, bool> matchSelectionCriteria)
        {
            Items.Clear();
            UnRegisterEvents();

            _pifArray = new List <PIF>(connection.Cache.PIFs);
            RegisterEvents();

            foreach (var pif in _pifArray)
            {
                var curPif = pif;
                if (!CanShowItem(curPif, out _))
                {
                    continue;
                }

                var item = new NetworkComboBoxItem(curPif, ShowPoolName);
                Items.Add(item);

                if (SelectedItem == null && matchSelectionCriteria(item))
                {
                    SelectedItem = item;
                }
            }
        }
示例#2
0
        private void AddItemToComboBox(NetworkComboBoxItem item)
        {
            if (IncludeOnlyEnabledNetworksInComboBox && !item.NetworkIsConnected)
            {
                return;
            }

            if (IncludeOnlyNetworksWithIPAddresses && !item.HasIPAddress)
            {
                return;
            }

            Items.Add(item);
        }
示例#3
0
        private bool CanShowItem(PIF pif, out NetworkComboBoxItem existingItem)
        {
            existingItem = Items.Cast <NetworkComboBoxItem>().FirstOrDefault(i => i.Network.opaque_ref == pif.network.opaque_ref);

            if (existingItem != null)
            {
                return(false);
            }

            if (ExcludeDisconnectedNetworks && pif.LinkStatus() != PIF.LinkState.Connected)
            {
                return(false);
            }

            if (ExcludeNetworksWithoutIpAddresses && !pif.IsManagementInterface(false))
            {
                return(false);
            }

            return(true);
        }
示例#4
0
        private void AddItemToComboBox(NetworkComboBoxItem item)
        {                
            if( IncludeOnlyEnabledNetworksInComboBox && !item.NetworkIsConnected )
            {
                return;
            }

            if (IncludeOnlyNetworksWithIPAddresses && !item.HasIPAddress)
            {
                return;
            }

            Items.Add(item);
        }