Exemple #1
0
 internal static void CreateRadioScrobbler()
 {
     if (radioScrobbler != null)
     {
         radioScrobbler.Stop();
     }
     radioScrobbler = new RadioScrobbler();
     radioScrobbler.Playing += ((sender, eventargs) =>
     {
         var track = eventargs.Track;
         if (eventargs.IsFirstTime)
         {
             if (track.Status == TrackStatus.Error)
             {
                 application.ShowBalloonTipError(null, track.Title);
                 application.SetNotifyIconText("{0}: {1}", "Error", track.Title);
             }
             else if (track.Status == TrackStatus.Idle)
             {
                 application.SetNotifyIconText("{0} esperando a que suene la mejor música...", Application.ProductName);
             }
             else
             {
                 var status = (track.Status == TrackStatus.Coming ? "Luego en" : "En") + " Horizonte";
                 if (Configuration.NotifySystemTray)
                 {
                     application.ShowBalloonTipTrack(status, track);
                 }
                 application.SetNotifyIconText("{0}: {1}", status, track.ToString());
             }
         }
     });
     radioScrobbler.Loved += ((sender, eventargs) =>
     {
         application.ShowBalloonTipInfo("Favorito", eventargs.Track.ToString());
     });
     radioScrobbler.Banned += ((sender, eventargs) =>
     {
         application.ShowBalloonTipInfo("Vetado", eventargs.Track.ToString());
     });
     radioScrobbler.Started += ((sender, eventargs) =>
     {
         application.ShowBalloonTipInfo(Application.ProductName, "Activado");
     });
     radioScrobbler.Stopped += ((sender, eventargs) =>
     {
         application.ShowBalloonTipInfo(Application.ProductName, "Desactivado");
     });
 }
 public void Start(RadioScrobbler radioScrobbler)
 {
     GLib.Timeout.Add(100, delegate
     {
         Application.Invoke(delegate
         {
             System.Windows.Forms.Application.DoEvents();
         });
         return true;
     });
     Application.Run();
 }
        public void Start(RadioScrobbler radioScrobbler)
        {
            Application.ApplicationExit += ((sender, e) =>
            {
                if (notifyIcon != null)
                {
                    notifyIcon.Visible = false;
                }
                radioScrobbler.Stop();
            });

            Application.Run();
        }