Ejemplo n.º 1
0
        public async Task RefreshData()
        {
            Favorites.Clear();
            var favoritesList = _favoritesManager.GetAll();

            foreach (var favoriteData in favoritesList)
            {
                try
                {
                    var result = await FavoriteData.Create(favoriteData, _dataProvider);

                    Favorites.Add(result);
                }
                catch (FavoriteCreateException favoriteException)
                {
                    Crashes.TrackError(favoriteException, new Dictionary <string, string>
                    {
                        { "routeId", favoriteData.RouteId },
                        { "stopId", favoriteData.StopId }
                    });
                    _favoritesManager.Delete(favoriteData.RouteId, favoriteData.StopId);
                }
                catch (Exception exc)
                {
                    Crashes.TrackError(exc, new Dictionary <string, string>
                    {
                        { "routeId", favoriteData.RouteId },
                        { "stopId", favoriteData.StopId }
                    });
                }
            }
        }
Ejemplo n.º 2
0
        private void ClearFavorites()
        {
            var rootFolder = _favManager.RootFolder;

            var folders = new ArrayList(rootFolder.SubFolders);
            var links   = new ArrayList(rootFolder.Links);

            foreach (FavoritesFolder folder in folders)
            {
                _favManager.Delete(folder);
            }

            foreach (FavoritesLink link in links)
            {
                _favManager.Delete(link);
            }
        }