public void LoadButtons() { if (WatchList.Contains(Movie.Title)) { IsRemoveVisible = true; IsAddVisible = false; } else { IsAddVisible = true; IsRemoveVisible = false; } }
private void AddWatch(object obj) { ProductMasterItem newWatch = obj as ProductMasterItem; if (newWatch == null) { return; } if (!WatchList.Contains(newWatch)) { WatchList.Add(newWatch); ExtendedSchedule.Instance.Update(); } }
public void AddToWatchList(string[] animes, List <Anime> animeList) { foreach (var item in animes) { if (!int.TryParse(item, out int index) || index >= animeList.Count || index < 0) { Program.DisplayError($"ERROR: INVALID INDEX: {item} PROVIDED, SO IT WON'T BE ADDED"); continue; } string title = animeList[index].Title; for (int i = title.Length - 1; i != 0; i--) { if (title[i] == '-') { var animeToBeAdded = new WatchListItem() { Title = title.Remove(i), LatestEpisode = 0, IsDownloaded = false, ReleaseDay = animeList[index].PubDate }; // Check if it already exists in the watchlist if (WatchList.Contains(animeToBeAdded)) { Program.DisplayError($"Anime \"{animeToBeAdded.Title}\" already exists in the watchlist"); break; } // Add a new watchlist value WatchList.Add(animeToBeAdded); break; } } } // Rechecks the whole list for containing animes foreach (var anime in animeList) { anime.IsInWatchList = ContainsInWatchList(anime); } WatchList.Sort(); }
private DisposableBeanstalkdClientLabel GetConcumer(IList <string> watchList) { lock (_pool) { BeanstalkdClientLabel client = null; if (_pool.Count == 0) { client = new BeanstalkdClientLabel { Client = ManagedBeanstalkdClientFactory.Create(_host, _port), CurrentTube = "default", WatchList = new List <string> { "default" } }; } else { var it = _pool.First; while (true) { if (it == null) { break; } if (AreWatchListsEqual(watchList, it.Value.WatchList)) { client = it.Value; break; } if (it == _pool.Last) { break; } it = it.Next; } if (client == null) { client = _pool.First.Value; } _pool.Remove(client); } if (!AreWatchListsEqual(client.WatchList, WatchList)) { WatchList.ForEach(tube => { if (!client.WatchList.Contains(tube)) { client.Client.Watch(tube); } }); client.WatchList.ForEach(tube => { if (!WatchList.Contains(tube)) { client.Client.Ignore(tube); } }); client.WatchList = WatchList; } return(new DisposableBeanstalkdClientLabel(client, _pool)); } }
public void ContainsInvalid() { Assert.Throws <ArgumentNullException> (() => list.Contains(null)); }