コード例 #1
0
        private async void Form1_Load(object sender, EventArgs e)
        {
            spotify.Update();
            progressBar1.Maximum = (int)mh.GetCurrentTrack().GetLength() * 100;
            pictureBox1.Image    = await spotify.GetMusicHandler().GetCurrentTrack().GetAlbumArtAsync(AlbumArtSize.SIZE_160);

            pictureBox2.Image = await spotify.GetMusicHandler().GetCurrentTrack().GetAlbumArtAsync(AlbumArtSize.SIZE_640);

            linkLabel1.Text         = mh.GetCurrentTrack().GetTrackName();
            linkLabel1.LinkClicked += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetTrackURI());
            linkLabel2.Text         = mh.GetCurrentTrack().GetArtistName();
            linkLabel2.LinkClicked += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetArtistURI());
            linkLabel3.Text         = mh.GetCurrentTrack().GetAlbumName();
            linkLabel3.LinkClicked += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetAlbumURI());

            label9.Text  = mh.IsPlaying().ToString();
            label11.Text = ((int)(mh.GetVolume() * 100)).ToString();
            label7.Text  = mh.IsAdRunning().ToString();

            eh.OnTrackChange     += new SpotifyEventHandler.TrackChangeEventHandler(trackchange);
            eh.OnTrackTimeChange += new SpotifyEventHandler.TrackTimeChangeEventHandler(timechange);
            eh.OnPlayStateChange += new SpotifyEventHandler.PlayStateEventHandler(playstatechange);
            eh.OnVolumeChange    += new SpotifyEventHandler.VolumeChangeEventHandler(volumechange);
            eh.SetSynchronizingObject(this);
            eh.ListenForEvents(true);
        }
コード例 #2
0
        public void Register(Dispatcher dispatcher)
        {
            spotify.Update();
            UpdateTrack(mh.GetCurrentTrack());

            eh.OnTrackChange     += OnTrackChange;
            eh.OnPlayStateChange += OnPlayStateChange;
            eh.OnTrackTimeChange += OnTrackTimeChange;

            eh.SetSynchronizingObject(new DispatcherWinFormsCompatAdapter(dispatcher));
            eh.ListenForEvents(true);
        }
コード例 #3
0
        public void LoadData()
        {
            Track = new TrackInfo();

            Track.CurrentTime = 0;
            Track.TotalTime   = (int)_mh.GetCurrentTrack().GetLength();
            Track.LoadBitmap(_mh.GetCurrentTrack().GetAlbumArt(AlbumArtSize.SIZE_160));
            Track.Name      = _mh.GetCurrentTrack().GetTrackName();
            Track.Artist    = _mh.GetCurrentTrack().GetArtistName();
            Track.Album     = _mh.GetCurrentTrack().GetAlbumName();
            Track.Lyrics    = _lw.GetLyrics(_mh.GetCurrentTrack());
            Track.IsPlaying = _mh.IsPlaying();

            _eh.OnTrackChange     += TrackChange;
            _eh.OnTrackTimeChange += TimeChange;
            _eh.OnPlayStateChange += PlayStateChange;
            _eh.ListenForEvents(true);
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: Redder/SpottyMP3
        private async void main_Load(object sender, EventArgs e)
        {
            this.Text = "SpottyMP3 v2." + version;  //Changes text to match version user is using
            addToLog("Initialization of SpottyMP3 v2." + version + " complete, enjoy!", logBox);

            spotify.Update();

            adPlaying.Text   = "AdPlaying: " + mh.IsAdRunning(); //Is an ad playing right now?
            songPlaying.Text = "Playing: " + mh.IsPlaying();     //Is a song playing right now?

            //If an add is not running then get the tracks image
            if (!mh.IsAdRunning())
            {
                currentPicture.Image = await spotify.GetMusicHandler().GetCurrentTrack().GetAlbumArtAsync(AlbumArtSize.SIZE_160);
            }
            try
            {
                currentBar.Maximum           = mh.GetCurrentTrack().GetLength() * 100; //Gets track length and sets the end of the track as maximum value of progress bar
                artistLinkLabel.Text         = mh.GetCurrentTrack().GetArtistName();   //Gets Current tracks artist name
                artistLinkLabel.LinkClicked += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetArtistURI());
                songLinkLabel.Text           = mh.GetCurrentTrack().GetTrackName();    //Gets Current tracks name
                songLinkLabel.LinkClicked   += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetTrackURI());
                albumLinkLabel.Text          = mh.GetCurrentTrack().GetAlbumName();    //Gets Current tracks album name
                albumLinkLabel.LinkClicked  += (senderTwo, args) => Process.Start(mh.GetCurrentTrack().GetAlbumURI());
            }
            catch (NullReferenceException) { }

            //Other contributers links, im going to add mine :)
            creatorLabel.LinkClicked          += (senderTwo, args) => Process.Start("http://www.hackforums.net/showthread.php?tid=4819899");
            downloadersourceLabel.LinkClicked += (senderTwo, args) => Process.Start("http://www.hackforums.net/showthread.php?tid=4497329");
            ogcreatorLabel.LinkClicked        += (senderTwo, args) => Process.Start("http://www.hackforums.net/showthread.php?tid=4506105");
            redderLabel.LinkClicked           += (senderTwo, args) => Process.Start("https://leakforums.net/user-49440");

            client.DownloadProgressChanged += client_DownloadProgressChanged;
            client.DownloadFileCompleted   += client_DownloadFileCompleted;

            eh.OnTrackChange     += new SpotifyEventHandler.TrackChangeEventHandler(trackChange);
            eh.OnTrackTimeChange += new SpotifyEventHandler.TrackTimeChangeEventHandler(timeChange);
            eh.OnPlayStateChange += new SpotifyEventHandler.PlayStateEventHandler(playstateChange);
            eh.OnVolumeChange    += new SpotifyEventHandler.VolumeChangeEventHandler(volumeChange);
            eh.SetSynchronizingObject(this);
            eh.ListenForEvents(true);

            if (string.IsNullOrWhiteSpace(Settings.Default.DownloadDestination)) //If there is no default download destination then set it to the program directory, else, set it to default download
            {
                browseForFolderBox.Text = System.AppDomain.CurrentDomain.BaseDirectory;
            }
            else
            {
                browseForFolderBox.Text = Settings.Default.DownloadDestination;
            }

            retryIfUnder1Mb.Checked          = Settings.Default.DownloadRetry;
            liveDownloads.Checked            = Settings.Default.DownloadAutomatically;
            showDownloadNotification.Checked = Settings.Default.DownloadNotifications;

            tt.AutoPopDelay = 5000;
            tt.InitialDelay = 1000;
            tt.ReshowDelay  = 500;
            tt.SetToolTip(retryIfUnder1Mb, "Whether or not to retry downloading a song if it finishes downloading smaller than 1MB");
        }