/// <summary> /// Fragt eine Ordnung ab. /// </summary> /// <param name="obj">Irgendein .NET Objekt.</param> /// <returns>Die Differenz der Ordnungszahlen zweier Quellen.</returns> public int CompareTo(object obj) { // Change type ChannelItem other = obj as ChannelItem; // Not comparable if (null == other) { return(-1); } // By name return(ToString().CompareTo(other.ToString())); }
private void selChannel_SelectionChangeCommitted(object sender, EventArgs e) { // Get the item ChannelItem channel = CurrentChannel; // None if (null == channel) { return; } // Clear helper lists ClearAudioAndService(); // Forward OnChannelSelected(channel.ChannelName, channel.Context); }
/// <summary> /// Initialisiert die Liste der Quellen. /// </summary> public void FillChannelList() { // Already did it if (m_ChannelsLoaded) { return; } // Once only m_ChannelsLoaded = true; // Reset index foreach (ChannelItem channel in m_Channels.Values) { channel.Index = null; } // Create temporary list List <ChannelItem> channels = new List <ChannelItem>(); // Check mode if (ShortCutsEnabled) { // Favorites only if (null != Configuration.FavoriteChannels) { foreach (string favorite in Configuration.FavoriteChannels) { // Try to find ChannelItem channel; if (!m_Channels.TryGetValue(favorite, out channel)) { continue; } // Use channels.Add(channel); } } } else { // All channels.AddRange(m_Channels.Values); // Sort channels.Sort(); } // Reset index chars m_LastKey = DateTime.MinValue; m_IndexChars = int.MaxValue; // Add shortcut information if (m_Embedded || ShortCutsEnabled) { // Calculate m_IndexChars = channels.Count.ToString().Length; // Create format pattern string format = new string( '0', m_IndexChars ); // Set index on all for (int i = channels.Count; i-- > 0;) { // Load ChannelItem channel = channels[i]; // Set index channel.Index = (i + 1).ToString(format); } } // Add to list selChannel.Items.Clear(); selChannel.Items.AddRange(channels.ToArray()); // Enable selChannel.Enabled = (selChannel.Items.Count > 0); }
/// <summary> /// Vermerkt eine Quelle. /// </summary> /// <param name="displayName">Der Name der Quelle.</param> /// <param name="context">Detailinformationen zur Quelle.</param> public void AddChannel( string displayName, object context ) { // Create and remember m_Channels[displayName] = new ChannelItem( displayName, context ); // Mark as changed m_ChannelsLoaded = false; }