Пример #1
0
        public override async Task Prepare()
        {
            await base.Prepare();

            IsLoading = true;

            RemainingCapacity = await tileManager.GetRemainingTileCapacityAsync();

            OnPropertyChanged("RemainingCapacity");

            var newTiles = (await tileManager.GetTilesAsync()).ToArray();
            var toAdd    = newTiles.Where(n => Tiles.All(o => o.Tile.Id != n.Id)).ToArray();
            var toRemove = Tiles.Where(o => newTiles.All(n => n.Id != o.Tile.Id)).ToArray();

            foreach (var tile in toAdd)
            {
                Tiles.Add(new TileViewModel(tile, tileManager));
            }
            foreach (var tile in toRemove)
            {
                Tiles.Remove(tile);
            }

            IsLoading = false;
        }
        public override async void OnAppearing(object navigationContext)
        {
            BandClient   = navigationContext as BandClient;
            _tileManager = BandClient.TileManager;

            // Load Remaining CApacity
            RemainingCapacity = await _tileManager.GetRemainingTileCapacityAsync();

            // Load Tiles
            await LoadTiles();

            base.OnAppearing(navigationContext);
        }