private void bPrevious_Click(object sender, EventArgs e) { if (mediaplayer != null) { mediaplayer.Previous(); } }
private void ExecMenu() { string ch = "\0"; do { ch = Console.ReadKey(true).KeyChar.ToString().ToUpper(); switch (ch) { case "P": //play/pause if (mediaplayer.IsStopped || mediaplayer.IsPausing) { mediaplayer.Play(); } else if (mediaplayer.IsPlaying) { mediaplayer.Pause(); } break; case "Z": //stop if (mediaplayer.IsPlaying || mediaplayer.IsPausing) { mediaplayer.Stop(); } break; case ",": case "<": // previous mediaplayer.Previous(); break; case ".": case ">": // next mediaplayer.Next(); break; case "S": // Seek if (mediaplayer.IsPlaying) { mediaplayer.Seek(15 * 1000); } break; case "+": if (mediaplayer.Volume < 100) { mediaplayer.Volume = Convert.ToByte(mediaplayer.Volume + 1); } break; case "-": if (mediaplayer.Volume > 0) { mediaplayer.Volume = Convert.ToByte(mediaplayer.Volume - 1); } break; } //switch } while (ch != "Q"); }