Exemple #1
0
 public override void Dispose()
 {
     if (_currentState == SpotifyState.Playing)
     {
         StopMusic();
     }
     if (_currentState == SpotifyState.LoggedIn)
     {
         LogOut();
     }
     if (_currentState == SpotifyState.Initialized)
     {
         try
         {
             Spotify.MusicDataAvailable -= OnMusicDataAvailable;
             Spotify.CheckBuffer        -= OnCheckBuffer;
             Spotify.Dispose();
             Spotify = null;
         }
         catch (Exception e)
         {
             // TODO: We should probably figure out what is causing that exception,
             //       in case it is something we can fix.
             Console.WriteLine(e.ToString());
         }
         _currentState = SpotifyState.Disposed;
     }
     base.Dispose();
 }