public void MediaElement_PositionChanged(object sender, Unosquare.FFME.Common.PositionChangedEventArgs e) { var percentage = (int)(100 * e.Position.TotalMilliseconds / MonitorViewModel.CurrentMedia.Duration.TotalMilliseconds); _logger.Info($"{Channel} : PositionChanged {e.Position} percentage {percentage}"); MonitorViewModel.FireProgressChanged(new ProgressChangedEventArgs(percentage, null)); }
public VideoViewModel(Stylet.IEventAggregator events) : base(events) { _timer.Tick += (snd, evt) => { var percentage = (int)(100 * _mediaElement?.Position.TotalMilliseconds / MonitorViewModel.CurrentMedia.Duration.TotalMilliseconds); _logger.Info($"{Channel} : PositionChanged {_mediaElement?.Position} percentage {percentage}"); MonitorViewModel.FireProgressChanged(new ProgressChangedEventArgs(percentage, null)); }; }
public ImageViewModel(Stylet.IEventAggregator events) : base(events) { _timer.Tick += (snd, evt) => { var percentage = (int)(100 * DateTime.Now.Subtract(MonitorViewModel.CurrentMediaShowDateTime).TotalMilliseconds / MonitorViewModel.CurrentMedia.Duration.TotalMilliseconds); _logger.Info("{0} : percentage {1}", Channel, percentage); MonitorViewModel.FireProgressChanged(new ProgressChangedEventArgs(percentage, null)); if (percentage >= 100) { _timer.Stop(); MonitorViewModel.FireMediaEnded(); } }; }