Esempio n. 1
0
        /// <summary>
        /// Markiert die bereits ausgewählten Ursprünge.
        /// </summary>
        /// <param name="template">Das verwendete Muster.</param>
        public void SetSelection(ScanTemplate template)
        {
            // Remember
            CurrentTemplate = template;

            // Reset all
            foreach (LocationItem item in lstLocations.Items)
            {
                item.Checked = false;
            }

            // Reset view
            lstLocations.Items[0].EnsureVisible();

            // Nothing more to to
            if (null == template)
            {
                return;
            }

            // Select
            foreach (string location in template.ScanLocations)
            {
                foreach (LocationItem item in lstLocations.Items)
                {
                    if (Equals(location, item.Location.UniqueName))
                    {
                        item.Checked = true;
                    }
                }
            }

            // Make first visible
            foreach (LocationItem item in lstLocations.Items)
            {
                if (item.Checked)
                {
                    // Move in
                    item.EnsureVisible();

                    // Done
                    break;
                }
            }
        }
Esempio n. 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);
        }
Esempio n. 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;
        }
        /// <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 );
        }
        /// <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;
        }
        /// <summary>
        /// Markiert die bereits ausgewählten Ursprünge.
        /// </summary>
        /// <param name="template">Das verwendete Muster.</param>
        public void SetSelection( ScanTemplate template )
        {
            // Remember
            CurrentTemplate = template;

            // Reset all
            foreach (LocationItem item in lstLocations.Items)
                item.Checked = false;

            // Reset view
            lstLocations.Items[0].EnsureVisible();

            // Nothing more to to
            if (null == template)
                return;

            // Select
            foreach (string location in template.ScanLocations)
                foreach (LocationItem item in lstLocations.Items)
                    if (Equals( location, item.Location.UniqueName ))
                        item.Checked = true;

            // Make first visible
            foreach (LocationItem item in lstLocations.Items)
                if (item.Checked)
                {
                    // Move in
                    item.EnsureVisible();

                    // Done
                    break;
                }
        }