Ejemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            //Query.ConnectQueryAsync();

            config = new SpotifyLocalAPIConfig
            {
                ProxyConfig = new ProxyConfig()
            };

            spotify = new SpotifyLocalAPI(config);

            Task.Run(() => WebApi.RunAuthentication());

            //Creates files needed
            SetFileLocation(false);
            CreatePlaylistFile();

            //Sets the listners
            spotify.OnTrackTimeChange += OnTrackTimeChange;
            spotify.OnTrackChange     += OnTrackChange;
            spotify.OnPlayStateChange += OnStateChange;

            Playlist.CreateBackgroundPlaylist();

            UpdateSongInfo();
        }
Ejemplo n.º 2
0
        public SpotifyHelper()
        {
            var config = new SpotifyLocalAPIConfig
            {
                ProxyConfig = new ProxyConfig()
            };

            _spotify = new SpotifyLocalAPI(config);
            Connect();
        }
Ejemplo n.º 3
0
        public void AuthSpotify()
        {
            _config = new SpotifyLocalAPIConfig
            {
                ProxyConfig = new ProxyConfig()
            };

            _spotify = new SpotifyLocalAPI(_config);
            _spotify.ListenForEvents = true;
        }
Ejemplo n.º 4
0
    public SpotifyService()
    {
        m_proxyConfig = new ProxyConfig();

        m_localProxyConfig = new SpotifyLocalAPIConfig
        {
            ProxyConfig = new ProxyConfig()
            {
                Port = 80,
            }
        };
    }
Ejemplo n.º 5
0
        private void DisposeLocalAPI()
        {
            if (this.localAPI != null)
            {
                this.localAPI.ListenForEvents    = false;
                this.localAPI.OnTrackChange     -= this.SpotifyLocalAPI_OnTrackChange;
                this.localAPI.OnPlayStateChange -= this.SpotifyLocalAPI_OnPlayStateChange;
                this.localAPI.OnTrackTimeChange -= this.SpotifyLocalAPI_OnTrackTimeChange;
                this.localAPI.OnVolumeChange    -= this.SpotifyLocalAPI_OnVolumeChange;

                this.localAPI.Dispose();
                this.localAPI = null;
            }

            this.localAPIConfig = null;
        }
Ejemplo n.º 6
0
        public void InitLocalAPI()
        {
            this.DisposeLocalAPI();

            this.localAPIConfig = new SpotifyLocalAPIConfig
            {
                TimerInterval = 500,
                ProxyConfig   = App.ProxyConfig.ProxyConfig
            };
            this.localAPI = new SpotifyLocalAPI(this.localAPIConfig);

            this.localAPI.OnTrackChange     += this.SpotifyLocalAPI_OnTrackChange;
            this.localAPI.OnPlayStateChange += this.SpotifyLocalAPI_OnPlayStateChange;
            this.localAPI.OnTrackTimeChange += this.SpotifyLocalAPI_OnTrackTimeChange;
            this.localAPI.OnVolumeChange    += this.SpotifyLocalAPI_OnVolumeChange;
            this.localAPI.ListenForEvents    = true;
        }
Ejemplo n.º 7
0
        public LocalControl()
        {
            InitializeComponent();

            _config = new SpotifyLocalAPIConfig
            {
                ProxyConfig = new ProxyConfig()
            };

            _spotify = new SpotifyLocalAPI(_config);
            _spotify.OnPlayStateChange += _spotify_OnPlayStateChange;
            _spotify.OnTrackChange     += _spotify_OnTrackChange;
            _spotify.OnTrackTimeChange += _spotify_OnTrackTimeChange;
            _spotify.OnVolumeChange    += _spotify_OnVolumeChange;
            //_spotify.SynchronizingObject = this;

            artistLinkLabel.Click += (sender, args) => Process.Start(artistLinkLabel.Tag.ToString());
            albumLinkLabel.Click  += (sender, args) => Process.Start(albumLinkLabel.Tag.ToString());
            titleLinkLabel.Click  += (sender, args) => Process.Start(titleLinkLabel.Tag.ToString());
        }