/// <summary> /// Renders posters for library /// </summary> /// <returns></returns> public async Task RenderPosters() { PanelPosters.Children.RemoveRange(0, PanelPosters.Children.Count); PanelList.Children.RemoveRange(0, PanelList.Children.Count); List <Series> allSeries = Database.GetSeries(); await Task.Run(async() => { foreach (Series series in allSeries) { BitmapImage bmp = await Database.GetSelectedPoster(series.id); Dispatcher.Invoke(() => { if (series.id == 321239) { } ; SeriesInLibrary poster = new SeriesInLibrary(series); poster.PosterImage.Source = bmp; poster.Height = Properties.Settings.Default.LibrarySize; poster.Width = Properties.Settings.Default.LibrarySize / 1.47058823529; poster.RemoveIcon.MouseLeftButtonUp += (s, ev) => RemoveFromLibrary(series, poster); poster.PosterIcon.MouseLeftButtonUp += (s, ev) => SelectPosters(poster, series); poster.QuestionIcon.MouseLeftButtonUp += (s, ev) => { MainWindow.SetPage(new SeriesDetails(series, new Library())); }; poster.PosterImage.MouseLeftButtonUp += (s, ev) => MainWindow.SetPage(new SeriesEpisodes(series)); PanelPosters.Children.Add(poster); }, DispatcherPriority.Send); } }); }
public async void SelectPosters(SeriesInLibrary sil, Series series) { Poster poster = await MainWindow.SelectPoster(series.id); await Task.Run(async() => { series.defaultPoster = poster; Database.EditSeries(series.id, series); if (sil != null) { Dispatcher.Invoke(() => { Storyboard sb = (Storyboard)FindResource("OpacityDown"); sb.Begin(sil.PosterImage); }, DispatcherPriority.Send); BitmapImage bmp = await Database.GetSelectedPoster(series.id); Dispatcher.Invoke(() => { sil.PosterImage.Source = bmp; Storyboard sb = (Storyboard)FindResource("OpacityUp"); sb.Begin(sil.PosterImage); }, DispatcherPriority.Send); } }); }