protected virtual void OnStatusEvent(LyricsFetchStatusEventArgs args) { if (this.StatusEvent != null) { this.StatusEvent(this, args); } }
/// <summary> /// Remove the given song from those being operated on. /// </summary> /// <param name="song">The song to be removed</param> protected override void CancelInternal(Song song) { LyricsFetchStatusEventArgs args = new LyricsFetchStatusEventArgs(); args.Song = song; args.Status = LyricsFetchStatus.Cancelled; this.OnStatusEvent(args); }
void lf_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { if (e.Status == LyricsFetchStatus.Done) { if (e.Lyrics == "") e.Song.Lyrics = "Failed"; else e.Song.Lyrics = e.Lyrics; } }
/// <summary> /// Add the song to the list of songs whose lyrics are being fetched /// </summary> /// <param name="song"></param> protected override void QueueInternal(Song song) { this.songStatusMap[song] = new FetchRequestData(); LyricsFetchStatusEventArgs args = new LyricsFetchStatusEventArgs(); args.Song = song; args.Status = LyricsFetchStatus.Waiting; this.OnStatusEvent(args); }
void fetchManager_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { this.BeginInvoke(new MethodInvoker(delegate() { this.olvSongs.RefreshObject(e.Song); this.EnableControls(); this.UpdateStatusText(); if (e.Status == LyricsFetchStatus.Done) { this.library.CacheLyrics(e.Song); if (this.olvSongs.IsSelected(e.Song)) { this.UpdateDetails(); } } })); }
private void fetcher_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { //if (e.Status == FetchStatus.SourceDone && this.GetStatus(e.Song) == FetchStatus.Fetching) // this.RecordAttempt(); // Remember which source is being checked if (e.Status == LyricsFetchStatus.Fetching && this.GetStatus(e.Song) == LyricsFetchStatus.Fetching) { this.GetFetchRequestData(e.Song).Source = e.LyricsSource; } // Is this the final event for a fetch that has not already been cancelled bool isFetchingDone = e.Status == LyricsFetchStatus.Done && this.GetStatus(e.Song) == LyricsFetchStatus.Fetching; if (isFetchingDone) { this.GetFetchRequestData(e.Song).Status = LyricsFetchStatus.Done; if (this.AutoUpdateLyrics) { try { this.UpdateLyrics(e.Song, e.Lyrics, e.LyricsSource); } catch (COMException) { // Something went wrong //TODO: Figure out a way to report this to the user } } } // Trigger an event while the lyrics fetch has finished but not yet gone this.OnStatusEvent(e); // Clean up the fetch if (isFetchingDone) { this.CleanupOne(e.Song); } }
void fetchManager_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { this.BeginInvoke(new MethodInvoker(delegate() { this.olvSongs.RefreshObject(e.Song); this.EnableControls(); this.UpdateStatusText(); if (e.Status == LyricsFetchStatus.Done) { this.library.CacheLyrics(e.Song); if (this.olvSongs.IsSelected(e.Song)) this.UpdateDetails(); } })); }
static void lfm_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { System.Diagnostics.Debug.WriteLine(e.Status); }
private void fetcher_StatusEvent(object sender, LyricsFetchStatusEventArgs e) { //if (e.Status == FetchStatus.SourceDone && this.GetStatus(e.Song) == FetchStatus.Fetching) // this.RecordAttempt(); // Remember which source is being checked if (e.Status == LyricsFetchStatus.Fetching && this.GetStatus(e.Song) == LyricsFetchStatus.Fetching) this.GetFetchRequestData(e.Song).Source = e.LyricsSource; // Is this the final event for a fetch that has not already been cancelled bool isFetchingDone = e.Status == LyricsFetchStatus.Done && this.GetStatus(e.Song) == LyricsFetchStatus.Fetching; if (isFetchingDone) { this.GetFetchRequestData(e.Song).Status = LyricsFetchStatus.Done; if (this.AutoUpdateLyrics) { try { this.UpdateLyrics(e.Song, e.Lyrics, e.LyricsSource); } catch (COMException) { // Something went wrong //TODO: Figure out a way to report this to the user } } } // Trigger an event while the lyrics fetch has finished but not yet gone this.OnStatusEvent(e); // Clean up the fetch if (isFetchingDone) { this.CleanupOne(e.Song); } }
/// <summary> /// Add the song to the list of songs whose lyrics are being fetched /// </summary> /// <param name="song"></param> protected override void QueueInternal(Song song) { this.songStatusMap[song] = new FetchRequestData(); LyricsFetchStatusEventArgs args = new LyricsFetchStatusEventArgs(); args.Song = song; args.Status = LyricsFetchStatus.Waiting; this.OnStatusEvent(args); }
protected virtual void OnStatusEvent(LyricsFetchStatusEventArgs args) { if (this.StatusEvent != null) this.StatusEvent(this, args); }
/// <summary> /// Remove the given song from those being operated on. /// </summary> /// <param name="song">The song to be removed</param> protected override void CancelInternal(Song song) { LyricsFetchStatusEventArgs args = new LyricsFetchStatusEventArgs(); args.Song = song; args.Status = LyricsFetchStatus.Cancelled; this.OnStatusEvent(args); }
void HandleStatusEvent(object sender, LyricsFetchStatusEventArgs args) { this.statusEventCount += 1; // SourceDone events count as Fetching status if (args.Status == LyricsFetchStatus.SourceDone) Assert.AreEqual(LyricsFetchStatus.Fetching, this.lfm.GetStatus(args.Song)); else Assert.AreEqual(args.Status, this.lfm.GetStatus(args.Song)); this.lastStatus = args.Status; }
void HandleDoneStatusEvent2(object sender, LyricsFetchStatusEventArgs args) { if (args.Status == LyricsFetchStatus.Done) { if (args.Lyrics == "") args.Song.Lyrics = "Failed"; else args.Song.Lyrics = args.Lyrics; } }
void HandleDoneStatusEvent(object sender, LyricsFetchStatusEventArgs args) { if (args.Status == LyricsFetchStatus.Done) doneEventCount += 1; }
void HandleCancelledStatusEvent(object sender, LyricsFetchStatusEventArgs args) { if (args.Status == LyricsFetchStatus.Cancelled) cancelledEventCount += 1; }