Пример #1
0
 private void UpdateAntennaSelection()
 {
     disableEvents++;
     try
     {
         // Get list of physical antennas
         List <string> enabledPhysicalAntennas = hNur.EnabledPhysicalAntennas;
         // Add enabled antennas to ComboBox
         selectedAntennaComboBox.Items.Clear();
         selectedAntennaComboBox.Items.Add(new SelectedAntenna(NurApi.ANTENNAID_AUTOSELECT, "Auto Select"));
         for (int i = 0; i < enabledPhysicalAntennas.Count; i++)
         {
             string antenna   = enabledPhysicalAntennas[i];
             int    antennaID = hNur.NurPhysicalAntennaToAntennaId(antenna);
             selectedAntennaComboBox.Items.Add(new SelectedAntenna(antennaID, antenna));
         }
         // Select Selected Antenna
         int selectedAntenna = hNur.SelectedAntenna;
         for (int i = 0; i < selectedAntennaComboBox.Items.Count; i++)
         {
             SelectedAntenna item = selectedAntennaComboBox.Items[i] as SelectedAntenna;
             if (item.Value == selectedAntenna)
             {
                 selectedAntennaComboBox.SelectedIndex = i;
                 break;
             }
         }
     }
     catch (NurApiException ex)
     {
         MessageBox.Show(ex.ToString(), Program.appName);
     }
     disableEvents--;
 }
Пример #2
0
        private void selectedAntennaComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (disableEvents > 0)
            {
                return;
            }

            try
            {
                ComboBox        cb  = sender as ComboBox;
                SelectedAntenna ant = cb.SelectedItem as SelectedAntenna;
                hNur.SelectedAntenna = ant.Value;
            }
            catch (NurApiException ex)
            {
                MessageBox.Show(ex.ToString(), Program.appName);
            }

            // Update Antenna conrols
            UpdateAntennaSelection();
        }