Exemplo n.º 1
0
        private void PlayerLoadCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                StopButton_Click(null, null);
                PlayButton.Enabled       = true;
                MusicProgressBar.Enabled = true;
                StopButton.Enabled       = true;

                trackSelectionManager.UnloadTracks();
                if (player.GetType() == typeof(MidiPlayer))
                {
                    MidiPlayer midiPlayer = player as MidiPlayer;
                    trackSelectionManager.LoadTracks(midiPlayer.GetMidiChannels(), midiPlayer.GetMidiTracks());
                    trackSelectionManager.FileName = currentTrackName;
                }

                if (trackSelectionManager.autoLoadProfile)
                {
                    trackSelectionManager.LoadTrackManager();
                }

                MusicProgressBar.Value   = 0;
                MusicProgressBar.Maximum = player.GetLenght();
                StartLabel.Text          = TimeSpan.FromSeconds(0).ToString(@"mm\:ss");
                EndTimeLabel.Text        = player.GetFormattedLength();
                CurrentMusicLabel.Text   = musicNameLabelHeader + currentTrackName;
                if (autoplay)
                {
                    Play();
                    autoplay = false;
                }
            }
            else
            {
                MessageBox.Show(e.Error.Message + " in " + e.Error.Source + e.Error.TargetSite + "\n" + e.Error.InnerException + "\n" + e.Error.StackTrace);
            }
        }