private void OnSearchResultFetched(TvShow show) { Invoke((MethodInvoker)delegate { var customTile = new TvShowTile(StyleManager) { TvShow = show }; if (!allResults.ContainsKey(customTile.TvShow.Id)) { allResults.Add(customTile.TvShow.Id, customTile.TvShow); fPanelSearchResults.Controls.Add(customTile); customTile.AddShowClicked += new EventHandler(SearchResultTile_Click); customTile.InfoClicked += new EventHandler(CustomTileOnInfoClicked); customTile.RemoveShowClicked += new EventHandler(customTile_RemoveShowClicked); } }); }
private Task LoadShowCollection() { fpSubbedShows.Controls.Clear(); var shows = _repo.GetSubscribedShows().Result; return Task.Factory.StartNew(() => { Invoke((MethodInvoker)delegate { fpSubbedShows.BackgroundImage = shows.Count == 0 ? Resources.NoShowsBackGround : null; }); foreach (var show in shows) { var controlToAdd = new TvShowTile(Program.Styler, true) { TvShow = show }; if (fpSubbedShows.Controls.Contains(controlToAdd)) continue; controlToAdd.InfoClicked += CustomTileOnInfoClicked; controlToAdd.RemoveShowClicked += customTile_RemoveShowClicked; Invoke((MethodInvoker)(() => fpSubbedShows.Controls.Add(controlToAdd))); } if(_episodeManager == null) _episodeManager = new EpisodeManager(fpSubbedShows.Controls.Cast<TvShowTile>().ToList()); }); }