Esempio n. 1
0
        /// <summary>
        /// fill the network combo box list with a custom combo box item
        /// </summary>
        /// <param name="vSelectedNetworkName"></param>
        /// <param name="vConnectivity"></param>
        private void FillNetworkList(string vSelectedNetworkName, NetworkConnectivityLevels vConnectivity)
        {
            cbNetwork.Items.Clear();

            NetworkCollection  netCollection = NetworkListManager.GetNetworks(vConnectivity); // NetworkConnectivityLevels.Connected);
            ComboboxItemCustom comboItem;

            var orderedList =
                netCollection.OrderBy(x => x.Name);

            //.ThenByDescending(x => x.Name);

            foreach (Network n in orderedList)
            {
                {
                    comboItem = new ComboboxItemCustom(n.Name, n.NetworkId.ToString(), n.IsConnectedToInternet);
                    cbNetwork.Items.Add(comboItem);

                    if (vSelectedNetworkName == n.Name)
                    {
                        cbNetwork.SelectedItem = comboItem;
                    }
                }
            }

            if (String.IsNullOrEmpty(vSelectedNetworkName))
            {
                cbNetwork.Text = "(Select One)";
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Set the selected network
        /// </summary>
        private void setNetwork()
        {
            Properties.Settings.Default.NetworkToCheck = cbNetwork.SelectedItem.ToString();
            Properties.Settings.Default.Save();

            btnSetNetwork.Text    = "Working...";
            btnSetNetwork.Enabled = false;
            cbNetwork.Enabled     = false;

            ComboboxItemCustom selectedItem = (ComboboxItemCustom)cbNetwork.SelectedItem;

            CheckNS = new NetworkSummary(Guid.Parse(selectedItem.Name));

            doMainTimerTick(true);

            cbNetwork.Enabled  = true;
            btnSetNetwork.Text = "Set Network Info";
        }