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); } } } }
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 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; } }