コード例 #1
0
ファイル: Program.cs プロジェクト: torshy/TRock.Music
        static void Main(string[] args)
        {
            var songPlayer = new TorshifySongPlayerClient(new Uri("http://localhost:8081"));

            Console.WriteLine("Connecting");

            var wait = new ManualResetEvent(false);

            songPlayer.Connect().ContinueWith(t =>
            {
                if (t.IsFaulted && t.Exception != null)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(t.Exception.GetBaseException().Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Environment.Exit(-1);
                }

                wait.Set();
            });

            if (wait.WaitOne(5000))
            {
                Console.WriteLine("Connected ;)");
                var songProvider = new SpotifySongProvider(new DefaultSpotifyImageProvider());
                SongQueueSample(songPlayer, songProvider);
                Console.ReadLine();
            }
        }
コード例 #2
0
 public void MoveNext_CurrentIsNotEmpty()
 {
     var provider = new SpotifySongProvider(new DefaultSpotifyImageProvider());
     var stream = new SimilarArtistsStream(provider, "NOFX", "RJOXXESVUVZ07WY1T");
     
     if (stream.MoveNext(CancellationToken.None))
     {
         Assert.NotEmpty(stream.Current);
     }
 }