Exemple #1
0
 public static ContactTrackInfo From(TrackInfo track)
 {
     if (track != null)
     {
         ContactTrackInfo ci = track.ExternalObject as ContactTrackInfo;
         return(ci);
     }
     return(null);
 }
Exemple #2
0
 public static IEnumerable <ContactTrackInfo> From(IEnumerable <TrackInfo> tracks)
 {
     foreach (TrackInfo track in tracks)
     {
         ContactTrackInfo ci = From(track);
         if (ci != null)
         {
             yield return(ci);
         }
     }
 }
        private void OnTubeManagerTracksDownloaded(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);
            });

            HyenaSqliteConnection conn = ServiceManager.DbConnection;

            conn.BeginTransaction();

            for (int i = 0; i < chunk.Length; i++)
            {
                IDictionary <string, object> track         = chunk[i];
                ContactTrackInfo             contact_track = new ContactTrackInfo(track, this);

                // notify once per chunk
                if (i == chunk.Length - 1)
                {
                    conn.CommitTransaction();
                    contact_track.Save(true);
                }
                else
                {
                    contact_track.Save(false);
                }
            }
        }
Exemple #4
0
		private void OnTubeManagerTracksDownloaded (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);
			});
			
            HyenaSqliteConnection conn = ServiceManager.DbConnection;
            conn.BeginTransaction ();

            for (int i = 0; i < chunk.Length; i++) {
                IDictionary <string, object> track = chunk[i];
                ContactTrackInfo contact_track = new ContactTrackInfo (track, this);

                // notify once per chunk
                if (i == chunk.Length - 1) {
                    conn.CommitTransaction ();
                    contact_track.Save (true);
                } else {
                    contact_track.Save (false);
                }
            }
		}
Exemple #5
0
 public TelepathyDownloadKey(ContactTrackInfo track) : base(track.Contact, track.ExternalId.ToString())
 {
     Track = track;
 }