private void OnTubeManagerPlaylistTracksDownloaded(object sender, EventArgs args) { DownloadedTracksEventArgs track_args = args as DownloadedTracksEventArgs; IDictionary <string, object> [] chunk = track_args.tracks as IDictionary <string, object> []; if (chunk == null) { return; } LibraryDownload d = track_args.download as LibraryDownload; ThreadAssist.ProxyToMain(delegate { SetStatus(String.Format(AddinManager.CurrentLocalizer.GetString("Loading {0} of {1}"), CalculateLoadingTracks(chunk.Length, d.TotalExpected), d.TotalExpected), false); }); ContactPlaylistSource source = null; if (playlist_map.ContainsKey(d)) { source = playlist_map[d]; } else { source = new ContactPlaylistSource(track_args.name, this); playlist_map.Add(d, source); } source.AddTracks(chunk); ThreadAssist.ProxyToMain(delegate { if (d != null && d.IsFinished) { Hyena.Log.DebugFormat("Download complete for {0}", source.Name); AddChildSource(source); playlist_map.Remove(d); HideStatus(); } }); }
private void OnTubeManagerPlaylistTracksDownloaded (object sender, EventArgs args) { DownloadedTracksEventArgs track_args = args as DownloadedTracksEventArgs; IDictionary <string, object> [] chunk = track_args.tracks as IDictionary <string, object> []; if (chunk == null) { return; } LibraryDownload d = track_args.download as LibraryDownload; ThreadAssist.ProxyToMain (delegate { SetStatus (String.Format (AddinManager.CurrentLocalizer.GetString ("Loading {0} of {1}"), CalculateLoadingTracks (chunk.Length, d.TotalExpected), d.TotalExpected), false); }); ContactPlaylistSource source = null; if (playlist_map.ContainsKey (d)) { source = playlist_map[d]; } else { source = new ContactPlaylistSource (track_args.name, this); playlist_map.Add (d, source); } source.AddTracks (chunk); ThreadAssist.ProxyToMain (delegate { if (d != null && d.IsFinished) { Hyena.Log.DebugFormat ("Download complete for {0}", source.Name); AddChildSource (source); playlist_map.Remove (d); HideStatus (); } }); }