private async Task LoadFavoriteChannels() { StorageFile file = null; try { file = await ApplicationData.Current.LocalFolder.GetFileAsync("favorites.txt"); } catch { } if (file != null) { using (var reader = new StreamReader(await file.OpenStreamForReadAsync())) { var favorites = await reader.ReadToEndAsync(); var array = favorites.Split(';'); foreach (var channel in AllChannels) { if (array.Contains(channel.Key)) { FavoriteChannels.Add(channel); } } } } }
public override void UpdateFavoriteRepo(string key, int channelId) { GetFavoriteFromRepo(key); if (FavoriteChannels.Contains(channelId)) { FavoriteChannels.Remove(channelId); } else { FavoriteChannels.Add(channelId); } Source[key] = FavoriteChannels; }
public override void UpdateFavoriteRepo(string key, int channelId) { GetFavoriteFromRepo(key); if (FavoriteChannels.Contains(channelId)) { FavoriteChannels.Remove(channelId); } else { FavoriteChannels.Add(channelId); } lock (Astro.Assignment.Web.Statics.StaticObjects.CacheLockKey) { ClearFavoriteFromRepo(key); Source.Add(key, FavoriteChannels, DateTimeOffset.MaxValue); } }