Пример #1
0
        void HandleOnSearchComplete(Session sender, SearchEventArgs e)
        {
            #if DEBUG
            if (Log.IsDebugEnabled)
                Log.Debug("HandleOnSearchComplete");
            #endif

            try
            {
            #if DEBUG
                if (Log.IsDebugEnabled) Log.Debug("Search returned: " + e.Result.TotalTracks + " tracks.");
            #endif
                foreach (Track track in e.Result.Tracks) _searchResults.Add(track);
                _searchComplete.Set();
            }
            catch (Exception ex)
            {
            #if DEBUG
                if (Log.IsErrorEnabled)
                    Log.Error("Exception", ex);
            #endif
            }
        }
Пример #2
0
		static void HandleOnSearchComplete(Session sender, SearchEventArgs e)
        {
            Console.WriteLine("Search returned:{0}{1}", Environment.NewLine, e.Result);
			
			if(e.Result.Tracks.Length > 0)
			{
				currentTrack = e.Result.Tracks[0];
				Console.WriteLine("Will play track:");
				Console.WriteLine(currentTrack.ToString());
				
				Console.WriteLine("Album:");
				Console.WriteLine(currentTrack.Album.ToString());
				
				Console.WriteLine("Load: " + sender.PlayerLoad(currentTrack));
				Console.WriteLine("Play: " + sender.PlayerPlay(true));
				if(sender.LoadImage(currentTrack.Album.CoverId, 12345))
					Console.WriteLine("Cover requested");
				else
					Console.WriteLine("Cover request failed");
				
			}
		}