Esempio n. 1
0
        private void Connect()
        {
            if (api != null)
            {
                api.OnTrackChange     -= OnTrackChange;
                api.OnPlayStateChange -= OnPlayStateChange;
                api.OnTrackTimeChange -= OnTrackTimeChange;
            }

            api = SpotifyApiFactory.GetSpotifyApi(config);
            api.Connect();

            if (api.IsConnected)
            {
                var status = api.GetStatus();
                UpdatePlayState(status.IsPlaying);
                UpdateDisplay(status.Track);
            }

            api.OnTrackChange     += OnTrackChange;
            api.OnPlayStateChange += OnPlayStateChange;
            api.OnTrackTimeChange += OnTrackTimeChange;
        }