Example #1
0
        private void ScannedLineupGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= scanned_channels_.Count)
            {
                return;
            }
            Channel           ch     = scanned_channels_[e.RowIndex];
            ScannedGridColumn column = ScannedColumnToEnum(e.ColumnIndex);

            switch (column)
            {
            case ScannedGridColumn.Listing:
                new ListingSelectionForm(ch).ShowDialog();
                ScannedLineupGridView.InvalidateCell(e.ColumnIndex, e.RowIndex);
                break;

            case ScannedGridColumn.Remove:
                try
                {
                    ChannelEditing.DeleteChannel(ch);
                }
                catch (Exception exc)
                {
                    new ErrorReporter.ErrorReportingForm("Exception occured when attempting to remove channel.", exc);
                }
                SelectAndLoadScannedLineup(scanned_lineup_);
                break;
            }
        }
Example #2
0
        private void RemoveChannelButton_Click(object sender, EventArgs e)
        {
            if (selected_channel_ == null)
            {
                return;
            }
            DialogResult dr = MessageBox.Show("Are you sure you want to remove channel ("
                                              + selected_channel_.ToString() + ") from the lineup?", "Confirm deletion", MessageBoxButtons.YesNo);

            if (dr != DialogResult.Yes)
            {
                return;
            }
            try
            {
                ChannelEditing.DeleteChannel(selected_channel_);
            }
            catch (Exception exc)
            {
                ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
                key_valued_exception.AddKeyValue("Channel", selected_channel_);
                new ErrorReportingForm("Exception occured when deleting a channel.", key_valued_exception);
            }
            PopulateUserChannelsListBox();
        }
Example #3
0
 private void InitLineupCombos()
 {
     Lineup[] lineups = ChannelEditing.GetLineups();
     SourceLineupCombo.Items.Clear();
     SourceLineupCombo.Items.AddRange(lineups);
     SourceLineupCombo.SelectedIndex = 0;
 }
 public AddChannelForm()
 {
     InitializeComponent();
     PopulateModulationListBox();
     ListingComboBox.Items.Add("No listing");
     ListingComboBox.Items.AddRange(ChannelEditing.GetServices().ToArray());
     ListingComboBox.SelectedIndex = 0;
 }
Example #5
0
        private void ScannedLineupGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= scanned_channels_.Count)
            {
                return;
            }
            Channel           ch     = scanned_channels_[e.RowIndex];
            ScannedGridColumn column = ScannedColumnToEnum(e.ColumnIndex);

            switch (column)
            {
            case ScannedGridColumn.Logo:
                try
                {
                    e.Value = GetChannelLogo(ch);
                }
                catch
                {
                    e.Value = new Bitmap(5, 5);
                }
                break;

            case ScannedGridColumn.Number:
                e.Value = ch.DisplayChannelNumber;
                break;

            case ScannedGridColumn.Listing:
                e.Value = ch.Service.Name + ":" + ch.Service.Provider.Name;
                break;

            case ScannedGridColumn.Type:
                e.Value = ch.ChannelType.ToString();
                break;

            case ScannedGridColumn.TunerCount:
                e.Value = ChannelEditing.GetTunerCount(ch);
                break;

            case ScannedGridColumn.Encrypted:
                e.Value = IsScannedEncrypted(ch);
                break;

            case ScannedGridColumn.TuningParams:
                if (ch.TuningInfos != null && !ch.TuningInfos.Empty)
                {
                    e.Value = ChannelEditing.GetTuningParamsAsString(ch.TuningInfos.First);
                }
                else
                {
                    e.Value = "No tuning infos";
                }
                break;

            case ScannedGridColumn.Callsign:
                e.Value = ch.CallSign;
                break;
            }
        }
Example #6
0
 private void InitScannedLineupsComboBox()
 {
     ScannedLineupSelectionComboBox.Items.Clear();
     ScannedLineupSelectionComboBox.Items.AddRange(ChannelEditing.GetScannedLineups().ToArray());
     if (ScannedLineupSelectionComboBox.Items.Count > 0)
     {
         ScannedLineupSelectionComboBox.SelectedIndex = 0;
     }
 }
Example #7
0
        private void SwapSubChannelRows(int index1, int index2)
        {
            Channel temp = subchannels_[index1];

            subchannels_[index1] = subchannels_[index2];
            subchannels_[index2] = temp;
            SubChannelsGrid.InvalidateRow(index1);
            SubChannelsGrid.InvalidateRow(index2);
            ChannelEditing.SetSubChannels(merged_channel_, subchannels_, true);
        }
Example #8
0
        private void PopulateUserChannelsListBox()
        {
            UserChannelsListBox.Items.Clear();
            if (selected_lineup_ == null)
            {
                return;
            }

            UserChannelsListBox.Items.AddRange(ChannelEditing.GetUserAddedChannelsForLineup(selected_lineup_).ToArray());
            UserChannelsListBox.Refresh();
        }
Example #9
0
        private void RemoveSourceChannelButton_Click(object sender, EventArgs e)
        {
            int row_index = SubChannelsGrid.CurrentRow.Index;

            if (row_index < 0 || row_index >= subchannels_.Count)
            {
                return;
            }
            Channel subchannel = subchannels_[row_index];

            ChannelEditing.RemoveSubChannel(merged_channel_, subchannel, false);
            RefreshSubchannelsGrid();
        }
Example #10
0
        internal static int CompareTuningParams(Channel ch1, Channel ch2)
        {
            bool ch1_has_tuning_info = ch1.TuningInfos != null && !ch1.TuningInfos.Empty;
            bool ch2_has_tuning_info = ch2.TuningInfos != null & !ch2.TuningInfos.Empty;

            if (ch1_has_tuning_info && ch2_has_tuning_info)
            {
                return(ChannelEditing.GetTuningParamsAsString(ch1.TuningInfos.First).CompareTo(
                           ChannelEditing.GetTuningParamsAsString(ch2.TuningInfos.First)));
            }
            else
            {
                return(ch1_has_tuning_info.CompareTo(ch2_has_tuning_info));
            }
        }
Example #11
0
 private void InitLineupComboBox()
 {
     Lineup[] lineups = ChannelEditing.GetLineups();
     // include only lineups with scanned devices here, as there are no tuners to add to otherwise.
     LineupSelectionComboBox.Items.Clear();
     foreach (Lineup lineup in lineups)
     {
         if (!lineup.ScanDevices.Empty)
         {
             LineupSelectionComboBox.Items.Add(lineup);
         }
     }
     if (LineupSelectionComboBox.Items.Count > 0)
     {
         LineupSelectionComboBox.SelectedIndex = 0;
     }
 }
Example #12
0
        private void AvailLineupGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= avail_channels_.Count())
            {
                return;
            }
            Channel ch = avail_channels_[e.RowIndex];
            AvailableSourceGridColumn column = AvailableSourceColumnFromIndex(e.ColumnIndex);

            switch (column)
            {
            case AvailableSourceGridColumn.Callsign:
                e.Value = ch.CallSign;
                break;

            case AvailableSourceGridColumn.Listing:
                e.Value = ch.Service;
                break;

            case AvailableSourceGridColumn.Number:
                e.Value = ch.DisplayChannelNumber;
                break;

            case AvailableSourceGridColumn.TunerCount:
                e.Value = ChannelEditing.GetTunerCount(ch);
                break;

            case AvailableSourceGridColumn.Type:
                e.Value = ch.ChannelType;
                break;

            case AvailableSourceGridColumn.TuningParams:
                if (ch.TuningInfos != null && !ch.TuningInfos.Empty)
                {
                    e.Value = ChannelEditing.GetTuningParamsAsString(ch.TuningInfos.First);
                }
                else
                {
                    e.Value = "No tuning infos";
                }
                break;
            }
        }
Example #13
0
        private void SubChannelsGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= subchannels_.Count)
            {
                return;
            }
            Channel subchannel             = subchannels_[e.RowIndex];
            CurrentSourceGridColumn column = CurrentSourceColumnFromIndex(e.ColumnIndex);

            switch (column)
            {
            case CurrentSourceGridColumn.Remove:
                ChannelEditing.RemoveSubChannel(merged_channel_, subchannel, false);
                RefreshSubchannelsGrid();
                break;

            case CurrentSourceGridColumn.Promote:
                if (e.RowIndex > 0)
                {
                    SwapSubChannelRows(e.RowIndex, e.RowIndex - 1);
                }
                break;

            case CurrentSourceGridColumn.Demote:
                if (e.RowIndex < subchannels_.Count - 1)
                {
                    SwapSubChannelRows(e.RowIndex, e.RowIndex + 1);
                }
                break;

            case CurrentSourceGridColumn.InheritCallsign:
                merged_channel_.CallSign = subchannel.CallSign;
                merged_channel_.Update();
                break;

            case CurrentSourceGridColumn.InheritListing:
                merged_channel_.Service = subchannel.Service;
                merged_channel_.Update();
                break;
            }
        }
        private void MergeButton_Click(object sender, EventArgs e)
        {
            MergedChannel        dest_channel = ((MergedChannelComboBoxWrapper)DestinationChannelComboBox.SelectedItem).channel;
            List <MergedChannel> merge_order  = new List <MergedChannel>();

            foreach (object item in ChannelSortingListBox.Items)
            {
                merge_order.Add(((MergedChannelComboBoxWrapper)item).channel);
            }
            bool past_dest_channel = false;

            foreach (MergedChannel mc in merge_order)
            {
                if (mc == dest_channel)
                {
                    past_dest_channel = true;
                    continue;
                }
                ChannelEditing.CombineMergedChannels(dest_channel, mc, !past_dest_channel, RemoveChannelsCheckbox.Checked);
            }
        }
Example #15
0
        private void AvailLineupGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= avail_channels_.Count())
            {
                return;
            }
            Channel ch = avail_channels_[e.RowIndex];
            AvailableSourceGridColumn column = AvailableSourceColumnFromIndex(e.ColumnIndex);

            switch (column)
            {
            case AvailableSourceGridColumn.AddFirst:
                ChannelEditing.AddScannedChannelToMergedChannel(ch, merged_channel_, true);
                RefreshSubchannelsGrid();
                break;

            case AvailableSourceGridColumn.AddLast:
                ChannelEditing.AddScannedChannelToMergedChannel(ch, merged_channel_, false);
                RefreshSubchannelsGrid();
                break;
            }
        }
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (ModulationListBox.SelectedItem == null)
            {
                MessageBox.Show("New channel must have a modulation type.");
                this.DialogResult = DialogResult.None;
                return;
            }

            if (CallsignInput.TextValue == "")
            {
                MessageBox.Show("Channel must have a callsign.");
                this.DialogResult = DialogResult.None;
                return;
            }

            try
            {
                ChannelEditing.AddUserChannelAndMergedChannelInLineup(
                    lineup_, CallsignInput.TextValue,
                    (int)ChannelNumberInput.NumberValue, (int)SubChannelInput.NumberValue,
                    (ModulationListBox.SelectedItem as ModulationTypeWrapper).modulation_type,
                    (int)GuideChannelNumberInput.NumberValue, (int)GuideSubchannelInput.NumberValue,
                    ListingComboBox.SelectedItem as Service);
            }
            catch (Exception exc)
            {
                ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
                key_valued_exception.AddKeyValue("lineup", lineup_);
                key_valued_exception.AddKeyValue("Callsign", CallsignInput.TextValue);
                key_valued_exception.AddKeyValue("Subchannel", SubChannelInput.NumberValue);
                key_valued_exception.AddKeyValue("Modulation", ModulationListBox.SelectedItem);
                key_valued_exception.AddKeyValue("GuideNumber", GuideChannelNumberInput.NumberValue);
                key_valued_exception.AddKeyValue("GuideSubChannel", GuideSubchannelInput.NumberValue);
                key_valued_exception.AddKeyValue("Service", ListingComboBox.SelectedItem);
                new ErrorReportingForm("Exception occured when attempting to add a channel", key_valued_exception);
            }
            this.DialogResult = AddButton.DialogResult;
        }
Example #17
0
        private void SubChannelsGrid_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= subchannels_.Count)
            {
                return;
            }
            Channel subchannel             = subchannels_[e.RowIndex];
            CurrentSourceGridColumn column = CurrentSourceColumnFromIndex(e.ColumnIndex);

            switch (column)
            {
            case CurrentSourceGridColumn.Callsign:
                e.Value = subchannel.CallSign;
                break;

            case CurrentSourceGridColumn.Lineup:
                e.Value = subchannel.Lineup;
                break;

            case CurrentSourceGridColumn.Listing:
                e.Value = subchannel.Service;
                break;

            case CurrentSourceGridColumn.Number:
                e.Value = subchannel.DisplayChannelNumber;
                break;

            case CurrentSourceGridColumn.TunerCount:
                e.Value = ChannelEditing.GetTunerCount(subchannel);
                break;

            case CurrentSourceGridColumn.Type:
                e.Value = subchannel.ChannelType;
                break;
            }
        }
Example #18
0
 private void AppendSourceChannel(Channel ch, StringBuilder sb)
 {
     sb.AppendFormat("{0}[{1}]", ch.ChannelNumber, (ch.ChannelType == ChannelType.Wmis) ? "WMI" : string.Format("{0} devices", ChannelEditing.GetTunerCount(ch)));
 }
Example #19
0
        private void MergedLineupGridView_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= merged_channels_.Count)
            {
                return;
            }
            MergedChannel           ch     = merged_channels_[e.RowIndex];
            MergedChannelGridColumn column = MergedChannelColumnToEnum(e.ColumnIndex);

            switch (column)
            {
            case MergedChannelGridColumn.Logo:
                try
                {
                    e.Value = GetChannelLogo(ch);
                }
                catch
                {
                    e.Value = new Bitmap(5, 5);
                }
                break;

            case MergedChannelGridColumn.Number:
                e.Value = ch.Number;
                break;

            case MergedChannelGridColumn.SubNumber:
                if (ch.SubNumber != 0)
                {
                    e.Value = ch.SubNumber;
                }
                else
                {
                    e.Value = null;
                }
                break;

            case MergedChannelGridColumn.Listing:
                e.Value = ch.Service;
                break;

            case MergedChannelGridColumn.ListingProvider:
                e.Value = ch.Service?.Provider?.Name;
                break;

            case MergedChannelGridColumn.Type:
                e.Value = ch.ChannelType.ToString();
                break;

            case MergedChannelGridColumn.TunerCount:
                e.Value = ChannelEditing.GetTunerCount(ch);
                break;

            case MergedChannelGridColumn.Visibility:
                e.Value = ch.Visibility.ToString();
                break;

            case MergedChannelGridColumn.UserBlockedState:
                e.Value = ch.UserBlockedState.ToString();
                break;

            case MergedChannelGridColumn.SourceChannels:
                e.Value = SerializeSourceChannelList(ch);
                break;

            case MergedChannelGridColumn.Encrypted:
                e.Value = ch.IsEncrypted;
                break;

            case MergedChannelGridColumn.HD:
                e.Value = IsChannelHD(ch);
                break;

            case MergedChannelGridColumn.InBand:
                e.Value = !ch.IgnoreInbandSchedule;
                break;
            }
        }
Example #20
0
 internal static int CompareTunerCount(Channel ch1, Channel ch2)
 {
     return(ChannelEditing.GetTunerCount(ch1) - ChannelEditing.GetTunerCount(ch2));
 }
Example #21
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     ChannelEditing.ReleaseHandles();
     // force terminate because of silly guide reindexing thread hanging.
     // Environment.Exit(0);
 }
Example #22
0
            private TuningConfig GetDefaultTuningConfigForChannelAndScannedLineup(SDChannel ch, Lineup lineup)
            {
                var         tunerType = ChannelEditing.GetTunerTypeForLineup(lineup);
                List <long> tunerIDs  = new List <long>();

                foreach (Device device in lineup.ScanDevices)
                {
                    tunerIDs.Add(device.Id);
                }
                TuningConfig tuning_config = new TuningConfig();

                tuning_config.tunerIDs = tunerIDs;
                switch (tunerType)
                {
                case ChannelEditing.TunerType.ATSC:
                    if (ch.atscMajor > 1 && ch.atscMinor > 0)
                    {
                        tuning_config.number    = ch.atscMajor;
                        tuning_config.subNumber = ch.atscMinor;
                    }
                    else
                    {
                        return(null);     // Tuner not compatible with channel
                    }
                    break;

                case ChannelEditing.TunerType.Aux:
                case ChannelEditing.TunerType.CableCARD:
                    if (ch.guideChannelMinor > 0)
                    {
                        return(null);                               // not compatible
                    }
                    tuning_config.number = ch.guideChannelMajor;
                    break;

                case ChannelEditing.TunerType.QAM:
                    if (ch.QAMMajor * ch.QAMMinor == 0)
                    {
                        return(null);                                    // not compatible
                    }
                    tuning_config.number    = ch.QAMMajor;
                    tuning_config.subNumber = ch.QAMMinor;
                    break;

                case ChannelEditing.TunerType.Analog:
                    if (ch.uhfVhf > 1)
                    {
                        tuning_config.number = ch.uhfVhf;
                    }
                    else if (ch.guideChannelMinor == 0)
                    {
                        tuning_config.number = ch.guideChannelMajor;
                    }
                    else
                    {
                        return(null);      // not compatible
                    }
                    break;

                case ChannelEditing.TunerType.DVBT:
                case ChannelEditing.TunerType.DVBS:
                case ChannelEditing.TunerType.DVBC:
                    if (ch.frequencyHz > 0)
                    {
                        tuning_config.deliverySystem   = ch.deliverySystem;
                        tuning_config.fec              = ch.fec;
                        tuning_config.frequencyHz      = ch.frequencyHz;
                        tuning_config.modulationSystem = ch.modulationSystem;
                        tuning_config.networkID        = ch.networkID;
                        tuning_config.polarization     = ch.polarization;
                        tuning_config.serviceID        = ch.serviceID;
                        tuning_config.symbolrate       = ch.symbolrate;
                        tuning_config.transportID      = ch.transportID;
                    }
                    else
                    {
                        return(null);      // not compatible
                    }
                    break;

                default:
                    Console.WriteLine("Channel not added with scanned lineup {0} because the tuner type is unrecognized", lineup.Name);
                    return(null);
                }  // end switch statement
                return(tuning_config);
            }
Example #23
0
 public override string ToString()
 {
     return(ChannelEditing.ModulationTypeName(modulation_type_));
 }
Example #24
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     ChannelEditing.ReleaseHandles();
 }
Example #25
0
 private void PopulateListingComboBox()
 {
     ListingComboBox.Items.Clear();
     ListingComboBox.Items.Add("No listing");
     ListingComboBox.Items.AddRange(ChannelEditing.GetServices().ToArray());
 }
Example #26
0
        private void CreateChannelButton_Click(object sender, EventArgs e)
        {
            if (CallsignInput.Text.Length == 0)
            {
                MessageBox.Show("Callsign is required.");
                return;
            }
            Service new_channel_service = null;

            if (destination_merged_channel_ != null)
            {
                new_channel_service = destination_merged_channel_.Service;
            }
            else
            {
                if (ListingSelectionCombo.SelectedItem is Service)
                {
                    new_channel_service = ListingSelectionCombo.SelectedItem as Service;
                }
                else if (ListingSelectionCombo.SelectedItem is ChannelService)
                {
                    new_channel_service = (ListingSelectionCombo.SelectedItem as ChannelService).Service;
                }
            }

            Channel new_channel = null;

            if (ChannelTypeTabControl.SelectedTab == ChannelTuningInfoPage)
            {
                ModulationType mod_type = ((ModulationTypeWrapper)ModulationCombo.SelectedItem).modulation_type;

                try
                {
                    new_channel = ChannelEditing.AddUserChannelToLineupWithoutMerge(
                        SelectedLineup, CallsignInput.Text, (int)ChannelNumberInput.Value, (int)SubchannelInput.Value,
                        mod_type, new_channel_service, GetCheckedDevices());
                }
                catch (Exception exc)
                {
                    AddInputsToException(exc);
                    new ErrorReporter.ErrorReportingForm("Exception occured when trying to add the scanned channel.", exc);
                    return;
                }
            }
            else if (ChannelTypeTabControl.SelectedTab == DVBTuningInfoPage)
            {
                try
                {
                    new_channel = ChannelEditing.AddDvbUserChannelToLineupWithoutMerge(
                        SelectedLineup, CallsignInput.Text, (int)ChannelNumberInput.Value, (int)SubchannelInput.Value,
                        int.Parse(DvbONIDCombo.Text), int.Parse(DvbTSIDCombo.Text), int.Parse(DvbSIDCombo.Text),
                        int.Parse(DvbNIDCombo.Text), int.Parse(DvbFrequencyCombo.Text), (int)DvbLCNInput.Value,
                        new_channel_service, GetCheckedDevices());
                }
                catch (Exception exc)
                {
                    AddInputsToException(exc);
                    new ErrorReporter.ErrorReportingForm("Exception occured when trying to add the DVB scanned channel.", exc);
                    return;
                }
            }
            else if (ChannelTypeTabControl.SelectedTab == DVBLinkPage)
            {
                try
                {
                    int dvblink_channel_key = (int)DVBLinkChannelNumInput.Value;
                    int frequency           = dvblink_channel_key * 10000;
                    new_channel = ChannelEditing.AddDvbUserChannelToLineupWithoutMerge(
                        SelectedLineup, CallsignInput.Text, (int)ChannelNumberInput.Value, (int)SubchannelInput.Value,
                        dvblink_channel_key, dvblink_channel_key, dvblink_channel_key, dvblink_channel_key,
                        frequency, (int)DVBLinkLCNInput.Value, new_channel_service, GetCheckedDevices());
                }
                catch (Exception exc)
                {
                    AddInputsToException(exc);
                    new ErrorReporter.ErrorReportingForm("Exception occured when trying to add the DVBLink scanned channel.", exc);
                    return;
                }
            }

            try
            {
                MergedChannel updated_merged_channel = null;
                if (destination_merged_channel_ != null)
                {
                    ChannelEditing.AddScannedChannelToMergedChannel(new_channel, destination_merged_channel_, AddAsFirstRadio.Checked);
                    updated_merged_channel = destination_merged_channel_;
                }
                else if (CreateNewChannelCheckbox.Checked)
                {
                    updated_merged_channel = ChannelEditing.CreateMergedChannelFromChannels(new List <Channel>(new Channel[] { new_channel }),
                                                                                            (int)GuideNumberInput.Value, (int)GuideSubNumberInput.Value);
                }

                /* if (ChannelAdded != null)
                 * {
                 *  ChannelAddedEventArgs args = new ChannelAddedEventArgs(e, updated_merged_channel, new_channel);
                 *  ChannelAdded(sender, args);
                 * } */
                guide_channel_entered_ = false;
            }
            catch (Exception exc)
            {
                if (new_channel != null)
                {
                    exc.Data.Add("new_channel number", new_channel.Number);
                    exc.Data.Add("new_channel subnumber", new_channel.SubNumber);
                    if (new_channel.TuningInfos != null)
                    {
                        exc.Data.Add("new_channel tuninginfo count", new_channel.TuningInfos.Count());
                    }
                    else
                    {
                        exc.Data.Add("new_channel tuning infos", "NULL");
                    }
                }
                else
                {
                    exc.Data.Add("new_channel", "NULL");
                }
                AddInputsToException(exc);
                new ErrorReporter.ErrorReportingForm("Exception occured when trying to put the newly created scanned channel in a merged channel.", exc);
                return;
            }
        }
Example #27
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;
                    }
                }
            }
        }
Example #28
0
 private void RefreshSubchannelsGrid()
 {
     subchannels_             = ChannelEditing.GetSubChannels(merged_channel_);
     SubChannelsGrid.RowCount = subchannels_.Count;
     SubChannelsGrid.Invalidate();
 }
Example #29
0
        static void Main(string[] args)
        {
            MergedLineups merged_lineups = new MergedLineups(ChannelEditing.object_store);
            MergedLineup  main_lineup    = merged_lineups.ToArray()[1];

            Lineup[] lineups = ChannelEditing.GetLineups();
            foreach (Lineup lineup in lineups)
            {
                if ((lineup.Name == "Scanned (Digital Cable (ClearQAM))") && lineup.ScanDevices.Empty)
                {
                    foreach (Channel ch in lineup.GetChannels())
                    {
                        lineup.RemoveChannel(ch);
                    }
                    lineup.Unlock();
                }
                if (!lineup.ScanDevices.Empty)
                {
                    lineup.PrimaryProvider = main_lineup;
                }
            }
            foreach (MergedLineup mergedlineup in merged_lineups)
            {
                if (mergedlineup.GetChannels().Count() == 0)
                {
                    mergedlineup.Unlock();
                    //merged_lineups.RemoveAllMatching(mergedlineup);
                }
            }
            Service[]     services      = new Services(ChannelEditing.object_store).ToArray();
            DeviceGroup[] device_groups = new DeviceGroups(ChannelEditing.object_store).ToArray();
            foreach (DeviceGroup device_group in device_groups)
            {
                Console.WriteLine("DeviceGroup: {0}", device_group.Name);
            }
            Device[] devices = new Devices(ChannelEditing.object_store).ToArray();
            foreach (Device d in devices)
            {
                Console.WriteLine("Device: {0}", d.Name);
            }
            DeviceType[] device_types = new DeviceTypes(ChannelEditing.object_store).ToArray();
            foreach (DeviceType dt in device_types)
            {
                Console.WriteLine("DeviceType: {0} DisplayName: {1} HeadendType: {2} Id: {3} IsSetTopBox: {4} NetworkType: {5} TuningSpaceName: {6} VideoSource: {7} ViewPriority: {8}",
                                  dt.Name, dt.DisplayName, dt.HeadendType, dt.Id, dt.IsSetTopBox, dt.NetworkType, dt.TuningSpaceName, dt.VideoSource, dt.ViewPriority);
                Microsoft.MediaCenter.TV.Tuning.TuningSpace tuning_space = dt.TuningSpace;
                if (tuning_space != null)
                {
                    Console.WriteLine("Tuning space CLSID: {0} FriendlyName: {1} UniqueName: {2}", tuning_space.CLSID, tuning_space.FriendlyName, tuning_space.UniqueName);
                }
            }
            foreach (Service service in services)
            {
                Console.WriteLine("Service: {0} IsCached: {1} IsMerged: {2}", service.Name, service.IsCached, service.IsMergedService);
            }
            if (false)
            {
                foreach (Lineup lineup in lineups)
                {
                    Console.WriteLine("Lineup: {0} ", lineup.Name);
                    if (lineup.DeviceGroup != null)
                    {
                        Console.WriteLine("DeviceGroup: {0}", lineup.DeviceGroup.Name);
                        if (lineup.DeviceGroup.Devices != null)
                        {
                            foreach (Device d in lineup.DeviceGroup.Devices)
                            {
                                Console.WriteLine(d.Name);
                            }
                        }
                    }
                    if (lineup.ScanDevices != null)
                    {
                        foreach (Device d in lineup.ScanDevices)
                        {
                            Console.WriteLine("ScanDevice: {0}", d);
                        }
                    }
                    if (lineup.WmisDevices != null)
                    {
                        foreach (Device d in lineup.WmisDevices)
                        {
                            Console.WriteLine("WmiDevice: {0}", d);
                        }
                        //if (lineup.WmisDevices.Empty && lineup.ScanDevices.Empty)
                        foreach (Channel ch in lineup.GetChannels())
                        {
                            if (ch.Service != null)
                            {
                                Console.WriteLine("Callsign: {0}, CHannelNumber {1}, Service Callsign {2}, Service Name {3}",
                                                  ch.CallSign, ch.ChannelNumber, ch.Service.CallSign, ch.Service.Name);
                                if (!ch.Service.ScheduleEntries.Empty)
                                {
                                    foreach (ScheduleEntry entry in ch.Service.ScheduleEntries)
                                    {
                                        if (entry.Program != null)
                                        {
                                            Console.WriteLine(entry.Program.Title);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    /*   foreach (Channel ch in lineup.GetChannels())
                     * {
                     *     Console.WriteLine("Channel: {0} Service: {1}", ch.Number, ch.Service);
                     * } */
                }
            }
            MergedLineup merged_lineup = lineups[0].PrimaryProvider;

            Console.WriteLine("MergedLineup: {0}", merged_lineup);
            if (merged_lineup.SecondaryLineups != null)
            {
                foreach (Lineup lineup in merged_lineup.SecondaryLineups)
                {
                    Console.WriteLine("Secondary Lineup: {0}", lineup.Name);
                }
            }
            Console.ReadLine();
            FavoriteLineups favorite_lineups = new FavoriteLineups(ChannelEditing.object_store);

            foreach (FavoriteLineup favorite in favorite_lineups)
            {
                Console.WriteLine(favorite.Name);
            }
            PackageSubscriptions subscriptions = new PackageSubscriptions(ChannelEditing.object_store);

            foreach (PackageSubscription sub in subscriptions)
            {
                Console.WriteLine(sub.Package.Description);
            }
        }
Example #30
0
 private void PopulateLineupsListBox()
 {
     LineupsComboBox.Items.Clear();
     LineupsComboBox.Items.AddRange(ChannelEditing.GetLineups());
 }