/// <summary>
        /// Initialisiert den Dialog.
        /// </summary>
        /// <param name="selector">Die zu verwendende Auswahlkomponente.</param>
        public void Initialize( ChannelSelector selector )
        {
            // Remember
            m_Configuration = selector.Configuration;

            // All favorites
            Dictionary<string, bool> favorites = new Dictionary<string, bool>();

            // Fill favorites
            if (null != m_Configuration.FavoriteChannels)
                foreach (string favorite in m_Configuration.FavoriteChannels)
                {
                    // Remember
                    favorites[favorite] = true;

                    // Add
                    lstFavorites.Items.Add( favorite );
                }

            // Fill channels
            foreach (ChannelItem channel in selector.Channels)
                if (!favorites.ContainsKey( channel.ChannelName ))
                    lstAll.Items.Add( channel.ChannelName );

            // Fill language list
            foreach (CultureInfo info in CultureInfo.GetCultures( CultureTypes.NeutralCultures ))
            {
                // Skip all sub-languages
                if (info.NativeName.IndexOf( " (" ) >= 0) continue;

                // Add to map
                selLanguage.Items.Add( info.NativeName );
            }

            // Copy over
            selLanguage.Text = m_Configuration.PreferredLanguage;
            ckUse.Checked = m_Configuration.EnableShortCuts;
            ckAC3.Checked = m_Configuration.PreferAC3;

            // Disable
            cmdSave.Enabled = false;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Erstellt eine neue Auswahlkomponente.
        /// </summary>
        /// <param name="embedded">Gesetzt, wenn die Komponente als integraler Bestandteil verwendet wird.</param>
        public ChannelSelector( bool embedded )
        {
            // Remember
            m_Embedded = embedded;

            // Load configuration
            Configuration = UserSettings.Load();

            // Configure
            InitializeComponent();

            // Nothing more to do
            if (m_Embedded) return;

            // Configure to handek model code
            Application.EnterThreadModal += new EventHandler( Application_EnterThreadModal );
            Application.LeaveThreadModal += new EventHandler( Application_LeaveThreadModal );

            // Register self
            Application.AddMessageFilter( this );
        }