Ejemplo n.º 1
0
        private void LineupSelectionComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <Device> channel_tuning_info_devices =
                ChannelEditing.GetLineupScannedDevicesByTuningInfoType(
                    SelectedLineup, ChannelEditing.TuningInfoType.ChannelTuningInfo);
            List <Device> dvb_devices =
                ChannelEditing.GetLineupScannedDevicesByTuningInfoType(
                    SelectedLineup, ChannelEditing.TuningInfoType.DvbTuningInfo);
            List <Device> dvblink_devices =
                ChannelEditing.GetLineupScannedDevicesByTuningInfoType(
                    SelectedLineup, ChannelEditing.TuningInfoType.DvbLink);

            bool supports_channeltuninginfo = channel_tuning_info_devices.Count != 0;
            bool supports_dvbtuning         = dvb_devices.Count != 0;
            bool has_dvblink = dvblink_devices.Count != 0;

            SetTabVisibility(ChannelTuningInfoPage, supports_channeltuninginfo);
            SetTabVisibility(DVBTuningInfoPage, supports_dvbtuning);
            SetTabVisibility(DVBLinkPage, has_dvblink);

            TunerSelectionListBox.Items.Clear();
            foreach (Device d in channel_tuning_info_devices)
            {
                TunerSelectionListBox.Items.Add(new DeviceWrapper(d));
            }
            for (int index = 0; index < channel_tuning_info_devices.Count; ++index)
            {
                TunerSelectionListBox.SetItemChecked(index, true);
            }

            DvbTunersCheckedListBox.Items.Clear();
            foreach (Device d in dvb_devices)
            {
                DvbTunersCheckedListBox.Items.Add(new DeviceWrapper(d));
            }
            for (int index = 0; index < dvb_devices.Count; ++index)
            {
                DvbTunersCheckedListBox.SetItemChecked(index, true);
            }

            DVBLinkTunerCheckedListBox.Items.Clear();
            foreach (Device d in dvblink_devices)
            {
                DVBLinkTunerCheckedListBox.Items.Add(new DeviceWrapper(d));
            }
            for (int index = 0; index < dvblink_devices.Count; ++index)
            {
                DVBLinkTunerCheckedListBox.SetItemChecked(index, true);
            }

            PopulateDvbCombos();

            // set modulation to match the first channel we find in the lineup.
            foreach (Channel ch in SelectedLineup.GetChannels())
            {
                if (ch.TuningInfos != null && !ch.TuningInfos.Empty)
                {
                    foreach (TuningInfo ti in ch.TuningInfos)
                    {
                        if (!(ti is ChannelTuningInfo))
                        {
                            continue;                             // DvbTuningInfos not handled!!!
                        }
                        ModulationType mod_type = ((ChannelTuningInfo)ti).ModulationType;
                        for (int index = 0; index < ModulationCombo.Items.Count; ++index)
                        {
                            if (((ModulationTypeWrapper)ModulationCombo.Items[index]).modulation_type == mod_type)
                            {
                                ModulationCombo.SelectedIndex = index;
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }