static Worker() { LocalApi = new SpotifyAPI.Local.SpotifyLocalAPI(); WebApi = new SpotifyAPI.Web.SpotifyWebAPI(); WebApi.UseAuth = false; }
private bool ConnectToSpotifyClient() { Debug.WriteLine("SpotifyManager:: Connect to client."); if (SpotLocalAPI.IsSpotifyRunning()) { CommandOpenSpotify.Instance.m_currentTextlabel = CommandOpenSpotify.kSpotifyOpenString; if (spotClient == null) { spotClient = new SpotLocalAPI(); } bool connected = spotClient.Connect(); #if DEBUG Debug.WriteLine("Spotify Client Connected: {0}", connected); Debug.Assert(connected); #endif if (connected) { RegisterEvents(); } spotClientConnected = connected; SettingsManager.GetSettingsManager().ApplyCurrentSettings(); return(connected); } CommandOpenSpotify.Instance.m_currentTextlabel = CommandOpenSpotify.kSpotifyStartString; SettingsManager.GetSettingsManager().ApplyCurrentSettings(); spotClientConnected = false; return(false); }
public static bool SpotifyConnect() { if (SpotifyAPI.Local.SpotifyLocalAPI.IsSpotifyRunning()) { if (spotClient == null) { spotClient = new SpotifyAPI.Local.SpotifyLocalAPI(); } //if (spotWeb == null) //{ // AuthenticateSpotifyWeb(); // // MessageBox.Show(spotWeb.AccessToken); //} bool connected = spotClient.Connect(); #if DEBUG Console.WriteLine("Spotify Client Connected: {0}", connected); Debug.Assert(connected); #endif spotClientConnected = connected; return(connected); } spotClientConnected = false; return(false); }
/// <summary> /// Initializes a new instance of the <see cref="Command1"/> class. /// </summary> public Command1Package() { // Inside this method you can place any initialization code that does not require // any Visual Studio service because at this point the package object is created but // not sited yet inside Visual Studio environment. The place to do all the other // initialization is the Initialize method. // m_packageDTEEvents = ApplicationObject.Events.DTEEvents; // m_packageDTEEvents.OnBeginShutdown += new _dispDTEEvents_OnBeginShutdownEventHandler(HandleVisualStudioShutDown); spotClient = new SpotifyAPI.Local.SpotifyLocalAPI(); spotClient.Connect(); }
public bool GetSpotifyConnectionStatus() { if (spotClient != null && spotClientConnected) { if (spotClient.GetStatus() == null) { spotClient = null; spotClientConnected = false; return(false); } return(true); } else { return(false); } }
public void OpenSpotify() { Debug.WriteLine("SpotifyManager:: OpenSpotify."); Process spotifyWindow = null; if ((spotifyWindow = GetSpotifyWindowProcess()) != null) { UnsafeNativeMethods.BringProcessToFront(spotifyWindow); } else if (!SpotLocalAPI.IsSpotifyRunning()) { Debug.WriteLine("Spotify not running."); SpotLocalAPI.RunSpotify(); System.Threading.Thread.Sleep(300); ConnectToSpotifyClient(); // update command hidden states. } }
private void DisconnectSpotifyClient() { spotClient.Dispose(); spotClient = null; spotClientConnected = false; }
public SpotifyManager() { spotClient = null; spotWeb = null; spotClientConnected = false; }