Changeset 140

Show
Ignore:
Timestamp:
03/06/07 21:52:01 (2 years ago)
Author:
kbarnes3
Message:

Added an event to notify the UI of song list changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/Bridge/Bridge.cs

    r139 r140  
    2424                /// </summary> 
    2525                public event EventHandler<ServerStatusEventArgs> ServerRemoved; 
     26 
     27                /// <summary> 
     28                /// Fires when the list of songs is changed 
     29                /// </summary> 
     30                public event EventHandler<SongListChangedEventArgs> SongListChanged; 
    2631 
    2732                /// <summary> 
     
    254259                                Console.WriteLine("Connected to " + newClient.Name); 
    255260 
     261                                if (this.SongListChanged != null) { 
     262                                        DataTable newSongs = this.getAvailableSongsInCollection(); 
     263                                        this.SongListChanged(this, new SongListChangedEventArgs(newSongs)); 
     264                                } 
     265 
    256266                                return newClient.Id; 
    257267                        } 
     
    302312                                        this.ServerRemoved(this, new ServerStatusEventArgs(oldServer.Name, true)); 
    303313                                } 
     314                                if (this.SongListChanged != null) { 
     315                                        DataTable newSongs = this.getAvailableSongsInCollection(); 
     316                                        this.SongListChanged(this, new SongListChangedEventArgs(newSongs)); 
     317                                } 
    304318                        } 
    305319                        else { 
  • dmp/trunk/Bridge/SongListChangeEventArgs.cs

    r139 r140  
    11using System; 
    22using System.Collections.Generic; 
     3using System.Data; 
    34using System.Text; 
    45 
     
    78        /// The arguments for a SongListChange event 
    89        /// </summary> 
    9         class SongListChangeEventArgs { 
     10        public class SongListChangedEventArgs : EventArgs { 
     11                /// <summary> 
     12                /// The new data table 
     13                /// </summary> 
     14                public DataTable NewTable; 
     15 
     16                /// <summary> 
     17                /// Creates a new instance of the SongListChangeEventArgs 
     18                /// </summary> 
     19                /// <param name="theTable">The new DataTable</param> 
     20                public SongListChangedEventArgs(DataTable theTable) { 
     21                        this.NewTable = theTable; 
     22                } 
     23 
    1024 
    1125        }