private void UpdateSize() { InstalledVersionsTotalSize = InstalledVersions.Select(i => i.Size).Sum(); InstalledVersionsFreeSize = InstalledVersions.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size); CacheTotalSize = Cache.Select(i => i.Size).Sum(); CacheFreeSize = Cache.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size); InfoBasesTotalSize = InfoBases.Select(i => i.Size).Sum(); InfoBasesFreeSize = InfoBases.Select(i => i).Where(i => i.IsChecked == true).Sum(i => i.Size); }
private async void PopulateInfoBasesAndCache() { InfoBasesArePopulating = true; InfoBases.Clear(); CacheArePopulating = true; Cache.Clear(); foreach (var item in await Platform.GetInfoBases()) { InfoBases.Add(new InfoBaseItemViewModel() { Name = item.Name, UUID = item.UUID, Size = item.Size, Connection = item.Connection, Version = item.Version }); } foreach (var item in await Platform.GetCache()) { Cache.Add(new CacheItemViewModel() { Path = item.Path, UUID = item.UUID, Size = item.Size }); } InfoBasesArePopulating = false; CacheArePopulating = false; foreach (var item in Cache) { item.Name = InfoBases.Where(i => i.UUID == item.UUID).FirstOrDefault()?.Name; item.IsChecked = string.IsNullOrEmpty(item.Name); item.Name = item.Name ?? "<База не найдена>"; } }