private async Task refreshPoisAsync() { string token = await _tokenService.GetAuthTokenAsync(); string userId = await _tokenService.GetUserIdAsync(); if (!string.IsNullOrEmpty(token)) { IsPoisLoaded = false; IsLoadingPoi = true; PoiApiRequest poiApi = new PoiApiRequest(token); var pois = await poiApi.GetMyPoisAsync(); PoiManager poiManager = new PoiManager(); pois.ForEach(p => { ViewPoi poi = new ViewPoi(p); poi.Save(); }); _pois = poiManager.GetAllAvailablePois(userId); await Task.WhenAll(_pois.Select(async p => await downloadPoiImgAsync(poiApi, p))); MainThread.BeginInvokeOnMainThread(() => { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("POIs")); IsPoisLoaded = !IsPoisLoaded; IsLoadingPoi = !IsLoadingPoi; }); } }
private void applyChanges() { Analytics.TrackEvent("Poi updated", new Dictionary <string, string> { { "Name", "Id" }, { _vpoi.Name, _vpoi.Id } }); _vpoi.UpdateDate = DateTimeOffset.Now; _vpoi.Save(); }
private async Task updatePoiStatusAsync() { if (!_newPoint) { TokenStoreService tokenService = new TokenStoreService(); string authToken = await tokenService.GetAuthTokenAsync(); PoiApiRequest poiApi = new PoiApiRequest(authToken); var wsPoi = await poiApi.GetPoiByRoutePointIdAsync(_vpoint.Id); if (poiApi.LastHttpStatusCode == HttpStatusCode.OK) { _vPoi = new ViewPoi(wsPoi); _vPoi.Save(); IsPoiExists = true; } } else { IsPoiExists = false; } }