예제 #1
0
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            // If we have no class open
            if (m_play == null)
            {
                try
                {
                    m_play            = new DxPlay(tbFileName.Text, panel1);
                    m_play.Completed += new EventHandler(m_play_Completed);

                    m_play.Start();

                    btnStart.Text      = "Stop";
                    tbFileName.Enabled = false;
                }
                catch (COMException ce)
                {
                    MessageBox.Show("Failed create DxPlay: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                m_play.Stop();
            }
        }
예제 #2
0
 private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (m_play != null)
     {
         m_play.Stop();
         m_play = null;
     }
 }
예제 #3
0
파일: Form1.cs 프로젝트: d3x0r/xperdex
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            // If necessary, close the old file
            if (m_State == State.Stopped)
            {
                // Did the filename change?
                if (tbFileName.Text != m_play.FileName)
                {
                    // File name changed, close the old file
                    m_play.Dispose();
                    m_play          = null;
                    m_State         = State.Uninit;
                    btnSnap.Enabled = false;
                }
            }

            // If we have no file open
            if (m_play == null)
            {
                try
                {
                    // Open the file, provide a handle to play it in
                    m_play = new DxPlay(panel1, tbFileName.Text);

                    // Let us know when the file is finished playing
                    m_play.StopPlay += new DxPlay.DxPlayEvent(m_play_StopPlay);
                    m_State          = State.Stopped;
                }
                catch (COMException ce)
                {
                    MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            // If we were stopped, start
            if (m_State == State.Stopped)
            {
                btnStart.Text = "Stop";
                m_play.Start();
                btnSnap.Enabled    = true;
                btnPause.Enabled   = true;
                tbFileName.Enabled = false;
                m_State            = State.Playing;
            }
            // If we are playing or paused, stop
            else if (m_State == State.Playing || m_State == State.Paused)
            {
                m_play.Stop();
                btnPause.Enabled   = false;
                tbFileName.Enabled = true;
                btnStart.Text      = "Start";
                btnPause.Text      = "Pause";
                m_State            = State.Stopped;
            }
        }
예제 #4
0
 private void m_play_Completed(object sender, EventArgs e)
 {
     DxPlay.CompletedArgs c = e as DxPlay.CompletedArgs;
     if (m_play != null)
     {
         m_play.Dispose();
         m_play = null;
     }
     tbFileName.Enabled = true;
     btnStart.Text      = "Start";
 }
예제 #5
0
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            // If we have no class open
            if (m_play == null)
            {
                try
                {
                    m_play = new DxPlay(tbFileName.Text, panel1);
                    m_play.Completed +=new EventHandler(m_play_Completed);

                    m_play.Start();

                    btnStart.Text = "Stop";
                    tbFileName.Enabled = false;

                }
                catch(COMException ce)
                {
                    MessageBox.Show("Failed create DxPlay: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                m_play.Stop();
            }
        }
예제 #6
0
 private void m_play_Completed(object sender, EventArgs e)
 {
     DxPlay.CompletedArgs c = e as DxPlay.CompletedArgs;
     if (m_play != null)
     {
         m_play.Dispose();
         m_play = null;
     }
     tbFileName.Enabled = true;
     btnStart.Text = "Start";
 }
예제 #7
0
 private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (m_play != null)
     {
         m_play.Stop();
         m_play = null;
     }
 }
예제 #8
0
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            // If necessary, close the old file
            if (m_State == State.Stopped)
            {
                // Did the filename change?
                if (tbFileName.Text != m_play.FileName)
                {
                    // File name changed, close the old file
                    m_play.Dispose();
                    m_play = null;
                    m_State = State.Uninit;
                    btnSnap.Enabled = false;
                }
            }

            // If we have no file open
            if (m_play == null)
            {
                try
                {
                    // Open the file, provide a handle to play it in
                    m_play = new DxPlay(panel1, tbFileName.Text);

                    // Let us know when the file is finished playing
                    m_play.StopPlay += new DxPlay.DxPlayEvent(m_play_StopPlay);
                    m_State = State.Stopped;
                }
                catch(COMException ce)
                {
                    MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            // If we were stopped, start
            if (m_State == State.Stopped)
            {
                btnStart.Text = "Stop";
                m_play.Start();
                btnSnap.Enabled = true;
                btnPause.Enabled = true;
                tbFileName.Enabled = false;
                m_State = State.Playing;
            }
            // If we are playing or paused, stop
            else if (m_State == State.Playing || m_State == State.Paused)
            {
                m_play.Stop();
                btnPause.Enabled = false;
                tbFileName.Enabled = true;
                btnStart.Text = "Start";
                btnPause.Text = "Pause";
                m_State = State.Stopped;
            }
        }