private void PositionTimer_Tick(object sender, EventArgs e) { if (KeyboardEvents.GetAsyncKeyState(Keys.RButton) != 0) { Point mousePosition = GetCurrentMousePosition(); tempTextBox.Text = "X: " + mousePosition.X + " Y: " + mousePosition.Y; PositionTimer.Stop(); } }
private async void SyncVideo() { if (_mediaPlayer != null) { bool success = _mediaPlayer.Update(); if (success) { _isPlaying = _mediaPlayer.IsPlaying; _currentVideoTime = _mediaPlayer.VideoTime; if (_currentVideoFileName != _mediaPlayer.FileName) { _currentVideoFileName = _mediaPlayer.FileName; LoadVideoTimecodes(_mediaPlayer.FileName, _mediaPlayer.FilePath); if (_videoTimer != null) { await _videoTimer.DisposeAsync(_videoTimeCodes == null); } if (_videoTimeCodes != null) { _videoTimer = new PositionTimer <(string, int)>(_videoTimeCodes.Select((v, i) => (v.Item1, (v.Item2, i))), SendCmd, _mediaPlayer.VideoTimeResolution, ("OFF", -1)); } else { _videoTimer = null; } } if (_videoTimer != null) { if (_mediaPlayer.IsPlaying) { _videoTimer.Update(TimeSpan.FromMilliseconds(_mediaPlayer.VideoTime)); } else { _videoTimer.Stop(); } } } else { _errorStatus = _mediaPlayer.ErrorStatus; ReInitialize(); } } _syncTimer.Change(1000, Timeout.Infinite); }
public void ReInitialize() { _videoTimer?.Stop(); _currentVideoFileName = ""; _windTrackHeader = ""; _currentVideoTime = 0; _videoTimeCodes = null; _curCmdIndex = -1; _nextCmdIndex = 0; _isPlaying = false; LoadLIRCMapping(); SelectMediaPlayer(); }