/// <summary> /// Raise the Resume event. /// </summary> private void player_MPC_Play(MPC.MSGIN msg) { isPlaying = true; if (Resume != null) { Resume(this, new EventArgs()); } }
/// <summary> /// Raise the Pause event. /// </summary> private void player_MPC_Stop(MPC.MSGIN msg) { isPlaying = false; if (Pause != null) { Pause(this, new EventArgs()); } }
/// <summary> /// Raise PositionChanged event. /// </summary> private void Player_MPC_CurrentPosition(MPC.MSGIN msg) { if (TimerGetPositionEnabled) { double PositionValue = 0; if (Double.TryParse(msg.Message, NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out PositionValue)) { position = PositionValue; if (PositionChanged != null) { PositionChanged(this, new EventArgs()); } } } }
/// <summary> /// When playing new file, update CurrentVideo.Length and raise NowPlaying event. /// </summary> /// <param name="msg"></param> private void Player_MPC_NowPlaying(MPC.MSGIN msg) { timerGetPosition.Start(); string[] FileInfo = msg.Message.Split('|'); CurrentVideo.Length = (short)double.Parse(FileInfo[4], CultureInfo.InvariantCulture); // In later version of MPC-HC, this event keeps firing repeatedly, so ignore when file path is the same. if (!string.IsNullOrEmpty(FileInfo[3]) && nowPlayingPath != FileInfo[3]) { nowPlayingPath = FileInfo[3]; position = 0; // restorePosition = 0; timerPlayTimeout.Stop(); if (NowPlaying != null) { NowPlaying(this, new EventArgs()); } TimerGetPositionEnabled = true; } }