Ejemplo n.º 1
0
        /// <summary>
        /// Erzeugt eine neue Steuerung.
        /// </summary>
        /// <param name="editor">Die Informationen zum zu pflegenden Geräteprofil.</param>
        /// <param name="site">Die Arbeitsumgebung der Erweiterung - üblicherweise das DVB.NET
        /// Administrationswerkzeug.</param>
        public ProfileDialog( ProfileEditor editor, IPlugInUISite site )
        {
            // Remember
            m_PlugIn = editor;
            m_Site = site;

            // Fill data from designer
            InitializeComponent();

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

            // Load static data
            if (groupType == typeof( SatelliteGroup ))
            {
                // Set default selection
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardSatelliteHardware, JMS.DVB.HardwareAbstraction" } );
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBSLegacy, JMS.DVB.Provider.Legacy" } );
            }
            else if (groupType == typeof( CableGroup ))
            {
                // Set default selection
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardCableHardware, JMS.DVB.HardwareAbstraction" } );
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBCLegacy, JMS.DVB.Provider.Legacy" } );
            }
            else if (groupType == typeof( TerrestrialGroup ))
            {
                // Set default selection
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardTerrestrialHardware, JMS.DVB.HardwareAbstraction" } );
                selType.Items.Add( new HardwareTypeItem { DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBTLegacy, JMS.DVB.Provider.Legacy" } );
            }
            else
            {
                // Fallback
                selType.Items.Add( new HardwareTypeItem { DisplayName = string.Empty, Type = null } );
            }

            // Reset sharing selection
            selShare.Items.Add( Properties.Resources.UseFrom_Self );

            // List of all profiles which we can choose from
            var profiles = new List<string>();

            // Get the current reference
            string from = m_PlugIn.Profile.UseSourcesFrom;
            try
            {
                // Just test all
                foreach (Profile profile in JMS.DVB.ProfileManager.AllProfiles)
                {
                    // Enter
                    m_PlugIn.Profile.UseSourcesFrom = profile.Name;

                    // Test
                    if (null != m_PlugIn.Profile.LeafProfile)
                        profiles.Add( profile.Name );
                }
            }
            finally
            {
                // Must always reset
                m_PlugIn.Profile.UseSourcesFrom = from;
            }

            // Sort list
            profiles.Sort();

            // Add list to selection
            selShare.Items.AddRange( profiles.ToArray() );

            // Select current
            if (string.IsNullOrEmpty( from ))
            {
                // Select the first entry
                selShare.SelectedIndex = 0;
            }
            else
            {
                // Select the indicated entry
                selShare.SelectedItem = from;
            }

            // Load recording settings
            m_RecordingSettings = RecordingSettings.ExtractSettings( m_PlugIn.Profile );

            // We are valid if the sharing is configured correctly (does not point to a dead entry)
            m_PlugIn.IsValid = (null != selShare.SelectedItem);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Erzeugt eine neue Steuerung.
        /// </summary>
        /// <param name="editor">Die Informationen zum zu pflegenden Geräteprofil.</param>
        /// <param name="site">Die Arbeitsumgebung der Erweiterung - üblicherweise das DVB.NET
        /// Administrationswerkzeug.</param>
        public ProfileDialog(ProfileEditor editor, IPlugInUISite site)
        {
            // Remember
            m_PlugIn = editor;
            m_Site   = site;

            // Fill data from designer
            InitializeComponent();

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

            // Load static data
            if (groupType == typeof(SatelliteGroup))
            {
                // Set default selection
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardSatelliteHardware, JMS.DVB.HardwareAbstraction"
                });
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBSLegacy, JMS.DVB.Provider.Legacy"
                });
            }
            else if (groupType == typeof(CableGroup))
            {
                // Set default selection
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardCableHardware, JMS.DVB.HardwareAbstraction"
                });
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBCLegacy, JMS.DVB.Provider.Legacy"
                });
            }
            else if (groupType == typeof(TerrestrialGroup))
            {
                // Set default selection
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Standard, Type = "JMS.DVB.StandardTerrestrialHardware, JMS.DVB.HardwareAbstraction"
                });
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = Properties.Resources.Type_Legacy, Type = "JMS.DVB.Provider.Legacy.DVBTLegacy, JMS.DVB.Provider.Legacy"
                });
            }
            else
            {
                // Fallback
                selType.Items.Add(new HardwareTypeItem {
                    DisplayName = string.Empty, Type = null
                });
            }

            // Reset sharing selection
            selShare.Items.Add(Properties.Resources.UseFrom_Self);

            // List of all profiles which we can choose from
            var profiles = new List <string>();

            // Get the current reference
            string from = m_PlugIn.Profile.UseSourcesFrom;

            try
            {
                // Just test all
                foreach (Profile profile in JMS.DVB.ProfileManager.AllProfiles)
                {
                    // Enter
                    m_PlugIn.Profile.UseSourcesFrom = profile.Name;

                    // Test
                    if (null != m_PlugIn.Profile.LeafProfile)
                    {
                        profiles.Add(profile.Name);
                    }
                }
            }
            finally
            {
                // Must always reset
                m_PlugIn.Profile.UseSourcesFrom = from;
            }

            // Sort list
            profiles.Sort();

            // Add list to selection
            selShare.Items.AddRange(profiles.ToArray());

            // Select current
            if (string.IsNullOrEmpty(from))
            {
                // Select the first entry
                selShare.SelectedIndex = 0;
            }
            else
            {
                // Select the indicated entry
                selShare.SelectedItem = from;
            }

            // Load recording settings
            m_RecordingSettings = RecordingSettings.ExtractSettings(m_PlugIn.Profile);

            // We are valid if the sharing is configured correctly (does not point to a dead entry)
            m_PlugIn.IsValid = (null != selShare.SelectedItem);
        }