示例#1
0
        /// <summary>
        /// Our song loader has finished. Remember the songs it found
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loader_DoneEvent(object sender, ProgressEventArgs e)
        {
            // Stop listening for events before doing anything else
            this.loader.ProgessEvent -= new EventHandler <ProgressEventArgs>(loader_ProgessEvent);
            this.loader.DoneEvent    -= new EventHandler <ProgressEventArgs>(loader_DoneEvent);

            this.songs = this.loader.Songs;

            this.OnDoneEvent(e);

            this.Cache.SaveLyricsCache();

            this.loader = null;
        }
示例#2
0
        /// <summary>
        /// Our song loader has finished. Remember the songs it found
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void loader_DoneEvent(object sender, ProgressEventArgs e)
        {
            // Stop listening for events before doing anything else
            this.loader.ProgessEvent -= new EventHandler<ProgressEventArgs>(loader_ProgessEvent);
            this.loader.DoneEvent -= new EventHandler<ProgressEventArgs>(loader_DoneEvent);

            this.songs = this.loader.Songs;

            this.OnDoneEvent(e);

            this.Cache.SaveLyricsCache();

            this.loader = null;
        }
示例#3
0
        /// <summary>
        /// This method starts the process of loading the db with songs.
        /// Call WaitLoad() to wait until the load is complete.
        /// </summary>
        public virtual void LoadSongs()
        {
            this.loader = this.ChooseSongLoader();

            // Configure the loader
            this.loader.LyricsCache = this.Cache;
            this.loader.MaxSongsToFetch = this.MaxSongsToFetch;
            this.loader.ProgessEvent += new EventHandler<ProgressEventArgs>(loader_ProgessEvent);
            this.loader.DoneEvent += new EventHandler<ProgressEventArgs>(loader_DoneEvent);

            // Let it do its stuff
            this.loader.RunAsync();
        }