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; } }
private void OpenFileFrm_Load(object sender, EventArgs e) { string pwdResult = MFHelper.NormalizeString( MFCommand.ExecuteCommand( Program.Options.Commands.CurrentDirectory, "")); selectedFiles_.Clear(); RefreshContent(pwdResult); }
public static string ExecuteCommand(string commands, string arguments) { MFCommand cmd = new MFCommand(commands, arguments); if (cmd.Execute()) { cmd.WaitForExit(); return cmd.ReadStandardOutput(); } else { return ""; } }
public static string ExecuteCommand(string commands, string arguments) { MFCommand cmd = new MFCommand(commands, arguments); if (cmd.Execute()) { cmd.WaitForExit(); return(cmd.ReadStandardOutput()); } else { return(""); } }
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")); }
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; }
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); } } } }
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; } }
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); } } } }