private void FrequencyForm_Load(object sender, EventArgs e) { if (this.channel is ChannelDVBT) { this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBT); } else if (this.channel is ChannelDVBC) { this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBC); } else if (this.channel is ChannelDVBS) { this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBS); } if (this.currentFrequencies != null) { this.comboBoxCountry.Items.Clear(); if (currentFrequencies != null) { foreach (string country in this.currentFrequencies.Keys) { this.comboBoxCountry.Items.Add(country); } } if (this.comboBoxCountry.Items.Count > 0) { this.comboBoxCountry.SelectedIndex = 0; } } }
private void buttonOK_Click(object sender, EventArgs e) { if (this.listBoxFrequencies.SelectedItem != null) { if (this.channel != null) { string frequency = this.listBoxFrequencies.SelectedItem as string; TransponderReader.PopulateChannelWithTransponderSettings(ref this.channel, frequency); } } }
// wizardPageScanner private void InitializeWizardPageScanner() { ChannelTV channelTV = this.propertyGridChannel.SelectedObject as ChannelTV; if (channelTV != null) { switch (channelTV.TunerType) { case TunerType.DVBT: this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBT); break; case TunerType.DVBC: this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBC); break; case TunerType.DVBS: this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.DVBS); break; case TunerType.Analogic: this.currentFrequencies = TransponderReader.GetFrequencies(TunerType.Analogic); break; } if (this.currentFrequencies != null) { this.comboBoxScanCountry.Items.Clear(); if (this.currentFrequencies != null) { foreach (string country in this.currentFrequencies.Keys) { this.comboBoxScanCountry.Items.Add(country); } } if (this.comboBoxScanCountry.Items.Count > 0) { this.comboBoxScanCountry.SelectedIndex = 0; } this.tabControlScanner.Enabled = true; } else { this.comboBoxScanCountry.Items.Clear(); this.comboBoxScanRegion.Items.Clear(); this.tabControlScanner.Enabled = false; } } }
private void buttonScanChannels_Click(object sender, EventArgs e) { if (this.propertyGridChannel.SelectedObject != null && this.propertyGridChannel.SelectedObject is ChannelTV) { MainForm.ClearGraph(); this.continueScanning = true; this.buttonScanChannels.Enabled = false; this.buttonScanStop.Enabled = true; ChannelTV templateChannelTV = this.propertyGridChannel.SelectedObject as ChannelTV; ChannelTV currentChannelTV; bool needRebuild = true; if (templateChannelTV is ChannelDVB) { if (this.tabControlScanner.SelectedTab == this.tabPageScanPredefined) { List <string> region; if (this.currentCountries.TryGetValue((string)this.comboBoxScanRegion.SelectedItem, out region)) { foreach (string currentFrequency in region) { if (!continueScanning) { break; } currentChannelTV = templateChannelTV.MakeCopy() as ChannelTV; TransponderReader.PopulateChannelWithTransponderSettings(ref currentChannelTV, currentFrequency); needRebuild = ScanProbeFrequency(currentChannelTV, needRebuild); } } } else if (this.tabControlScanner.SelectedTab == this.tabPageScanManual) { int startFrequency = int.Parse(this.textBoxScanStartFrequency.Text); int stopFrequency = int.Parse(this.textBoxScanStopFrequency.Text); int bandwidth = int.Parse(this.textBoxScanBandwidth.Text); int currentFrequency = startFrequency; while (currentFrequency <= stopFrequency && continueScanning) { currentChannelTV = templateChannelTV.MakeCopy() as ChannelTV; (currentChannelTV as ChannelDVB).Frequency = currentFrequency; currentFrequency += bandwidth; needRebuild = ScanProbeFrequency(currentChannelTV, needRebuild); } } } else if (templateChannelTV is ChannelAnalogic) { int startChannelNumber = 0; // int.Parse(this.textBoxScanStartFrequency.Text); int stopChannelNumber = 100; // int.Parse(this.textBoxScanStopFrequency.Text); int currentChannelNumber = startChannelNumber; while (currentChannelNumber <= stopChannelNumber && continueScanning) { currentChannelTV = templateChannelTV.MakeCopy() as ChannelTV; (currentChannelTV as ChannelAnalogic).Channel = currentChannelNumber; currentChannelNumber++; needRebuild = ScanProbeFrequency(currentChannelTV, needRebuild); } } this.buttonScanChannels.Enabled = true; this.buttonScanStop.Enabled = false; } else { MessageBox.Show(Properties.Resources.WizardYouMustCreateChannelTemplate); } }