コード例 #1
0
        private void stopToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor old = Cursor;

            Cursor = Cursors.WaitCursor;

            try
            {
                if (command_ != null)
                {
                    command_.CommandExit -= new EventHandler(command__CommandExit);
                    command_.Output      -= new EventHandler(command__Output);

                    state_ = MFStateEnum.Stopped;

                    command_.WriteStandardInput(Program.Options.Controls.Stop);
                    command_.WaitForExit();

                    command_ = null;
                }
            }
            finally
            {
                Cursor = old;
            }
        }
コード例 #2
0
        private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (command_ != null && state_ != MFStateEnum.Stopped)
            {
                if (state_ != MFStateEnum.Paused)
                {
                    state_ = MFStateEnum.Paused;
                }
                else
                {
                    state_ = MFStateEnum.Playing;
                }

                command_.WriteStandardInput(Program.Options.Controls.Pause);
            }
        }
コード例 #3
0
        private void command__CommandExit(object sender, EventArgs e)
        {
            if (command_ != null && sender == command_)
            {
                if (state_ == MFStateEnum.Playing)
                {
                    state_ = MFStateEnum.Stopped;

                    command_.WaitForExit();
                    command_ = null;

                    if (lvwPlayList.InvokeRequired)
                    {
                        lvwPlayList.Invoke(new EventHandler(nextFileToolStripMenuItem_Click), sender, e);
                    }
                    else
                    {
                        nextFileToolStripMenuItem_Click(sender, e);
                    }
                }
            }
        }
コード例 #4
0
        private void playToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor oldCursor = Cursor;

            Cursor = Cursors.WaitCursor;

            try
            {
                if (state_ == MFStateEnum.Paused)
                {
                    pauseToolStripMenuItem_Click(sender, e);
                    return;
                }
                else if (state_ == MFStateEnum.Playing)
                {
                    stopToolStripMenuItem_Click(sender, e);
                }

                string playFile = null;

                if (currentFile_ == null)
                {
                    if (lvwPlayList.SelectedItems.Count > 0)
                    {
                        playFile = lvwPlayList.SelectedItems[0].Text;
                    }
                    else if (lvwPlayList.Items.Count > 0)
                    {
                        playFile = lvwPlayList.Items[0].Text;
                    }
                }
                else
                {
                    playFile = currentFile_;
                }

                if (playFile != null)
                {
                    if (!playFile.Equals(currentFile_))
                    {
                        UpdateCurrentPlayingFile(playFile);
                    }

                    command_ = new MFCommand(Program.Options.Controls.RealPlayFile,
                                             currentFile_, false);

                    if (command_.Execute())
                    {
                        command_.CommandExit += new EventHandler(command__CommandExit);
                        command_.Output      += new EventHandler(command__Output);

                        state_ = MFStateEnum.Playing;
                    }
                    else
                    {
                        command_.WaitForExit();
                        command_ = null;
                    }
                }
            }
            finally
            {
                Cursor = oldCursor;
            }
        }
コード例 #5
0
        private void stopToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor old = Cursor;

            Cursor = Cursors.WaitCursor;

            try
            {
                if (command_ != null)
                {
                    command_.CommandExit -= new EventHandler(command__CommandExit);
                    command_.Output -= new EventHandler(command__Output);

                    state_ = MFStateEnum.Stopped;

                    command_.WriteStandardInput(Program.Options.Controls.Stop);
                    command_.WaitForExit();

                    command_ = null;
                }
            }
            finally
            {
                Cursor = old;
            }
        }
コード例 #6
0
        private void playToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor oldCursor = Cursor;

            Cursor = Cursors.WaitCursor;

            try
            {
                if (state_ == MFStateEnum.Paused)
                {
                    pauseToolStripMenuItem_Click(sender, e);
                    return;
                }
                else if (state_ == MFStateEnum.Playing)
                {
                    stopToolStripMenuItem_Click(sender, e);
                }

                string playFile = null;

                if (currentFile_ == null)
                {
                    if (lvwPlayList.SelectedItems.Count > 0)
                    {
                        playFile = lvwPlayList.SelectedItems[0].Text;
                    }
                    else if (lvwPlayList.Items.Count > 0)
                    {
                        playFile = lvwPlayList.Items[0].Text;
                    }
                }
                else
                {
                    playFile = currentFile_;
                }

                if (playFile != null)
                {
                    if (!playFile.Equals(currentFile_))
                    {
                        UpdateCurrentPlayingFile(playFile);
                    }

                    command_ = new MFCommand(Program.Options.Controls.RealPlayFile,
                        currentFile_, false);

                    if (command_.Execute())
                    {
                        command_.CommandExit += new EventHandler(command__CommandExit);
                        command_.Output += new EventHandler(command__Output);

                        state_ = MFStateEnum.Playing;
                    }
                    else
                    {
                        command_.WaitForExit();
                        command_ = null;
                    }
                }
            }
            finally
            {
                Cursor = oldCursor;
            }
        }
コード例 #7
0
        private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (command_ != null && state_ != MFStateEnum.Stopped)
            {
                if (state_ != MFStateEnum.Paused)
                {
                    state_ = MFStateEnum.Paused;
                }
                else
                {
                    state_ = MFStateEnum.Playing;
                }

                command_.WriteStandardInput(Program.Options.Controls.Pause);
            }
        }
コード例 #8
0
        private void command__CommandExit(object sender, EventArgs e)
        {
            if (command_!= null && sender == command_)
            {
                if (state_ == MFStateEnum.Playing)
                {
                    state_ = MFStateEnum.Stopped;

                    command_.WaitForExit();
                    command_ = null;

                    if (lvwPlayList.InvokeRequired)
                    {
                        lvwPlayList.Invoke(new EventHandler(nextFileToolStripMenuItem_Click), sender, e);
                    }
                    else
                    {
                        nextFileToolStripMenuItem_Click(sender, e);
                    }
                }
            }
        }