public override void WireMessages() { Messenger.Default.Register <NotificationMessage>(this, async m => { if (m.Notification.Equals(Constants.Messages.PlayVideoItemMsg)) { if (m.Sender != null) { SelectedItem = (BaseItemDto)m.Sender; if (m.Target != null) { _isResume = (bool)m.Target; } } } if (m.Notification.Equals(Constants.Messages.SendVideoTimeToServerMsg)) { try { var totalTicks = _isResume && StartTime.HasValue ? StartTime.Value.Ticks + PlayedVideoDuration.Ticks : PlayedVideoDuration.Ticks; Log.Info("Sending current runtime [{0}] to the server", totalTicks); await _apiClient.ReportPlaybackStoppedAsync(SelectedItem.Id, AuthenticationService.Current.LoggedInUser.Id, totalTicks); SelectedItem.UserData.PlaybackPositionTicks = totalTicks; } catch (HttpException ex) { Log.ErrorException("SendVideoTimeToServer", ex); } } }); }