Ejemplo n.º 1
0
        //MediaPlay
        private void execMediaPlay(bool boolPlayAndStop)
        {
            if (boolPlayAndStop)
            {
                int iAuduoLen        = (int)(mplayer.AudioLength / 1000);
                int iCurrentPosition = (int)(mplayer.CurrentPosition / 1000);

                trackBar1.Value = iCurrentPosition;

                this.lblTrackCount.Text = "[iCurrentPosition/iAuduoLen = " + iCurrentPosition.ToString() + " / " + iAuduoLen.ToString() + "]";

                if (iAuduoLen == iCurrentPosition && mplayer.IsPlaying)
                {
                    mplayer.Stop();
                    trackBar1.Value = 0;
                }
                else
                {
                    if (!mplayer.IsPlaying)
                    {
                        if (MediaFiles.Count > 0)
                        {
                            intSEQ = intSEQ + 1;
                            string filename = MediaFiles[intSEQ];

                            if (mplayer.Open(strMediaDir + @"\" + filename.Trim()))
                            {
                                CommandHistory.Text       += "\r\n";
                                CommandHistory.Text       += (intSEQ + 1).ToString() + "번째 File Playing.... " + filename.Trim();
                                this.lblMediaFileName.Text = filename;
                                trackBar1.Maximum          = (int)(mplayer.AudioLength / 1000);
                                mplayer.Play();
                            }
                        }
                    }
                }
            }
            else
            {
                timer1.Enabled = false;
                mplayer.Stop();
                MediaFiles.Clear();
            }
        }//end execMediaPlay()
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "mp3 files|*.mp3";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                button1.Text = fd.FileName;
                mplayer.Open(fd.FileName);
            }
        }