コード例 #1
0
        private void ChangeState(MP3MODE _mode)
        {
            switch (_mode)
            {
            case MP3MODE.Play:
            case MP3MODE.Pause:
                if (!string.IsNullOrEmpty(_mp3player.FileName))
                {
                    if (_mode == MP3MODE.Play)
                    {
                        _mp3player.Play();
                        _timer.Start();
                        _sfxTimer.Start();
                        _textbox_playtime.Enabled = false;
                    }
                    else if (_mode == MP3MODE.Pause)
                    {
                        _mp3player.Pause();
                        _timer.Stop();
                        _sfxTimer.Stop();
                        _textbox_playtime.Enabled = true;
                        _textbox_playtime.Text    = _mp3player.CurrentPosition.ToString();
                    }
                }
                else
                {
                    MessageBox.Show("음악이 없습니다!", "경고", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                break;

            case MP3MODE.Stop:
                _mp3player.Stop();
                _timer.Stop();
                _sfxTimer.Stop();
                break;
            }
            label1.Focus();
        }
コード例 #2
0
 private void btnPause_Click(object sender, EventArgs e)
 {
     _mediaPlayer.Pause();
     changeStaus(EnumStatus.pause);
 }