예제 #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 OpenFileFrm_Load(object sender, EventArgs e)
        {
            string pwdResult =
                MFHelper.NormalizeString(
                    MFCommand.ExecuteCommand(
                        Program.Options.Commands.CurrentDirectory, ""));

            selectedFiles_.Clear();

            RefreshContent(pwdResult);
        }
예제 #3
0
        public static string ExecuteCommand(string commands, string arguments)
        {
            MFCommand cmd = new MFCommand(commands, arguments);

            if (cmd.Execute())
            {
                cmd.WaitForExit();

                return cmd.ReadStandardOutput();
            }
            else
            {
                return "";
            }
        }
예제 #4
0
        public static string ExecuteCommand(string commands, string arguments)
        {
            MFCommand cmd = new MFCommand(commands, arguments);

            if (cmd.Execute())
            {
                cmd.WaitForExit();

                return(cmd.ReadStandardOutput());
            }
            else
            {
                return("");
            }
        }
예제 #5
0
        private bool IsDirectory(string p)
        {
            string fileName = p;

            if (!fileName.StartsWith("/"))
            {
                fileName = currentDirectory_ + "/" + fileName;
            }

            string content =
                MFCommand.ExecuteCommand(Program.Options.Commands.StatFiletype,
                                         fileName);

            return(content.Equals("directory"));
        }
예제 #6
0
        private void RefreshContent(string directory)
        {
            Cursor oldCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;

            currentDirectory_ = directory;
            UpdateCurrentDirectory();

            string content =
                MFCommand.ExecuteCommand(Program.Options.Commands.ListFiles,
                                         currentDirectory_);

            ParseContent(content);

            this.Cursor = oldCursor;
        }
예제 #7
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);
                    }
                }
            }
        }
예제 #8
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;
            }
        }
예제 #9
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;
            }
        }
예제 #10
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;
            }
        }
예제 #11
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);
                    }
                }
            }
        }