Beispiel #1
0
        public async Task UpdateMarker(string operationId, string markerId)
        {
            var markerData = await _wasabeeApiV1Service.Operations_GetMarker(operationId, markerId);

            if (markerData != null)
            {
                await _markersDatabase.SaveMarkerModel(markerData, operationId);

                _mvxMessenger.Publish(new MarkerDataChangedMessage(this, markerData, operationId));
            }
        }
        /// <summary>
        /// Local data updates to ensure Operation is always up-to-date, even if FCM is not working.
        /// </summary>
        /// <returns></returns>
        private async Task UpdateMarkerAndNotify()
        {
            if (MarkerAssignment != null && Marker != null)
            {
                var updated = await _wasabeeApiV1Service.Operations_GetMarker(MarkerAssignment.OpId, Marker.Id);

                if (updated != null)
                {
                    Marker           = updated;
                    IsSelfAssignment = _userSettingsService.GetLoggedUserGoogleId().Equals(Marker.AssignedTo);

                    UpdateButtonsState();

                    await _markersDatabase.SaveMarkerModel(Marker, MarkerAssignment.OpId);

                    _messenger.Publish(new MarkerDataChangedMessage(this, Marker, MarkerAssignment.OpId));
                }
                else
                {
                    IsBusy = false;
                    CloseCommand.Execute();
                }
            }
        }