コード例 #1
0
        /// <summary>
        /// Beginnt mit der Ausführung der Aufgabe.
        /// </summary>
        /// <returns>Gesetzt, wenn die Aufgabe synchron abgeschlossen wurde.</returns>
        bool IPlugInControl.Start()
        {
            // Finish
            selGroups.GetSelection();

            // Reset locations
            m_PlugIn.Profile.ScanLocations.Clear();

            // Check mode
            if (m_SatTemplates.Count < 1)
            {
                // The one any only DVB-C or DVB-T
                m_PlugIn.Profile.ScanLocations.Add(selGroups.CurrentTemplate);
            }
            else
            {
                // Choose all
                foreach (ScanTemplate <SatelliteLocation> location in m_SatTemplates)
                {
                    // Load the type
                    DiSEqCLocations selection = location.Location.LNB;

                    // Must match
                    switch (selMode.SelectedIndex)
                    {
                    case 0: if (DiSEqCLocations.None != selection)
                        {
                            continue;
                        }
                        break;

                    case 1: if ((DiSEqCLocations.BurstOn != selection) && (DiSEqCLocations.BurstOff != selection))
                        {
                            continue;
                        }
                        break;

                    case 2: if ((DiSEqCLocations.DiSEqC1 != selection) && (DiSEqCLocations.DiSEqC2 != selection) && (DiSEqCLocations.DiSEqC3 != selection) && (DiSEqCLocations.DiSEqC4 != selection))
                        {
                            continue;
                        }
                        break;

                    default: continue;
                    }

                    // Remember
                    m_PlugIn.Profile.ScanLocations.Add(location);
                }
            }

            // Just put to disk
            m_PlugIn.Profile.Save();

            // Done
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Bereitet die Benutzerschnittstelle vor.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void ConfigurationDialog_Load(object sender, EventArgs e)
        {
            // Set up the name of the selected profile
            lbProfile.Text = string.Format(lbProfile.Text, m_PlugIn.Profile.Name);

            // Disable DiSEqC selection
            pnlDiSEqC.Visible = false;

            // Get the type of the source groups
            Type groupType = m_PlugIn.Profile.GetGroupType();

            if (null == groupType)
            {
                return;
            }

            // See if it is satellite
            if (!typeof(SatelliteGroup).IsAssignableFrom(groupType))
            {
                // Template to use
                ScanTemplate scan;

                // Create new
                if (typeof(CableGroup).IsAssignableFrom(groupType))
                {
                    // Create for DVB-C
                    scan = new ScanTemplate <CableLocation> {
                        Location = new CableLocation()
                    };
                }
                else if (typeof(TerrestrialGroup).IsAssignableFrom(groupType))
                {
                    // Create for DVB-T
                    scan = new ScanTemplate <TerrestrialLocation> {
                        Location = new TerrestrialLocation()
                    };
                }
                else
                {
                    // Actually this is strange
                    return;
                }

                // Preset
                if (m_PlugIn.Profile.ScanLocations.Count > 0)
                {
                    scan.ScanLocations.AddRange(((ScanTemplate)m_PlugIn.Profile.ScanLocations[0]).ScanLocations);
                }

                // First only
                selGroups.SetSelection(scan);

                // Done
                return;
            }

            // Enable DiSEqC input
            pnlDiSEqC.Visible = true;

            // Do not use DiSEqC
            selMode.SelectedIndex = 0;

            // Check mode
            foreach (ScanTemplate <SatelliteLocation> scanLocation in m_PlugIn.Profile.ScanLocations)
            {
                if (null != scanLocation.Location)
                {
                    // Get the type of the location selection
                    DiSEqCLocations selection = scanLocation.Location.LNB;

                    // No DiSEqC
                    if (DiSEqCLocations.None == selection)
                    {
                        break;
                    }

                    // Simple (burst) mode
                    if ((DiSEqCLocations.BurstOn == selection) || (DiSEqCLocations.BurstOff == selection))
                    {
                        // Choose
                        selMode.SelectedIndex = 1;

                        // Done
                        break;
                    }

                    // DiSEqC 1.0
                    if ((DiSEqCLocations.DiSEqC1 == selection) || (DiSEqCLocations.DiSEqC2 == selection) || (DiSEqCLocations.DiSEqC3 == selection) || (DiSEqCLocations.DiSEqC4 == selection))
                    {
                        // Choose
                        selMode.SelectedIndex = 2;

                        // Done
                        break;
                    }
                }
            }

            // Finsih selection
            selMode_SelectionChangeCommitted(selMode, EventArgs.Empty);
        }
コード例 #3
0
        /// <summary>
        /// Die Auswahl des zu konfigurierenden Ursprungs wurde verändert.
        /// </summary>
        /// <param name="sender">Wird ignoriert.</param>
        /// <param name="e">Wird ignoriert.</param>
        private void selDish_SelectionChangeCommitted(object sender, EventArgs e)
        {
            // Hide
            pnlSpecial.Visible = false;

            // Copy back current settings - if any
            selGroups.GetSelection();

            // What to select
            DiSEqCLocations selection = CurrentLocation;

            // Template to use
            ScanTemplate <SatelliteLocation> scan = m_SatTemplates.Find(t => t.Location.LNB == selection);

            if (null == scan)
            {
                // Create new
                scan = new ScanTemplate <SatelliteLocation>();

                // Find it
                foreach (ScanTemplate <SatelliteLocation> scanLocation in m_PlugIn.Profile.ScanLocations)
                {
                    if (null != scanLocation.Location)
                    {
                        if (scanLocation.Location.LNB == selection)
                        {
                            // Copy over
                            scan.Location = SatelliteLocation.Parse(scanLocation.Location.ToString());
                            scan.ScanLocations.AddRange(scanLocation.ScanLocations);

                            // Did it - use only the first one
                            break;
                        }
                    }
                }

                // Create new from default
                if (null == scan.Location)
                {
                    scan.Location =
                        new SatelliteLocation
                    {
                        Frequency1      = SatelliteLocation.Defaults.Frequency1,
                        Frequency2      = SatelliteLocation.Defaults.Frequency2,
                        SwitchFrequency = SatelliteLocation.Defaults.SwitchFrequency,
                        UsePower        = SatelliteLocation.Defaults.UsePower,
                        LNB             = selection
                    }
                }
                ;

                // Remember
                m_SatTemplates.Add(scan);
            }

            // Load locations
            selGroups.SetSelection(scan);

            // Load LNB settings
            selLOF1.Value   = scan.Location.Frequency1;
            selLOF2.Value   = scan.Location.Frequency2;
            selSwitch.Value = scan.Location.SwitchFrequency;
            ckPower.Checked = scan.Location.UsePower;
        }
コード例 #4
0
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 public SatelliteLocation()
 {
     // Reset all
     LNB = DiSEqCLocations.None;
 }