public async void ShowWatchingNowMovie(TraktMovie movie, DateTime watchTime) { this.WatchingNowGrid.Visibility = System.Windows.Visibility.Visible; if ((AppUser.Instance.BackgroundWallpapersEnabled || (AppUser.Instance.ImagesWithWIFI && StorageController.IsConnectedToWifi()))) { this.LayoutRoot.Background = new ImageBrush { ImageSource = await movieController.getFanartImage(movie.imdb_id, movie.Images.Fanart), Opacity = 0.0, Stretch = Stretch.UniformToFill, }; } App.ViewModel.clearWatching(); this.WatchingNowGrid.Visibility = System.Windows.Visibility.Visible; ListItemViewModel model = new ListItemViewModel() { Type = "movie", Year = movie.year, Name = movie.Title, ImageSource = movie.Images.Fanart, Imdb = movie.imdb_id, SubItemText = movie.year.ToString() }; model.LoadScreenImage(); TimeSpan percentageCompleteTimeSpan = DateTime.UtcNow - watchTime; model.WatchedCompletion = ((Double)percentageCompleteTimeSpan.TotalMinutes / (Double)(movie.Runtime)) * 100; if (Double.IsInfinity(model.WatchedCompletion)) { model.WatchedCompletion = 0; } App.ViewModel.WatchingNow = model; if (this.LayoutRoot.Background != null) { Animation.ImageFadeIn(this.LayoutRoot.Background); } Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { App.ViewModel.NotifyPropertyChanged("WatchingNow"); })); }
public async void ShowWatchingNowShow(TraktEpisode episode, TraktShow show, DateTime watchTime) { this.WatchingNowGrid.Visibility = System.Windows.Visibility.Visible; this.LayoutRoot.Background = new ImageBrush { ImageSource = await showController.getFanartImage(show.tvdb_id, show.Images.Fanart), Opacity = 0.0, Stretch = Stretch.UniformToFill, }; App.ViewModel.clearWatching(); this.WatchingNowGrid.Visibility = System.Windows.Visibility.Visible; ListItemViewModel model = new ListItemViewModel() { Type = "episode", Year = show.year, Name = show.Title, ImageSource = episode.Images.Screen, Imdb = show.tvdb_id + episode.Season + episode.Number, SubItemText = "Season " + episode.Season + ", Episode " + episode.Number, Episode = episode.Number, Season = episode.Season, Tvdb = show.tvdb_id, Watched = episode.Watched, Rating = episode.MyRatingAdvanced, InWatchList = episode.InWatchlist }; model.LoadScreenImage(); TimeSpan percentageCompleteTimeSpan = DateTime.UtcNow - watchTime; model.WatchedCompletion = ((Double)percentageCompleteTimeSpan.TotalMinutes / (Double)(show.Runtime)) * 100; if (Double.IsInfinity(model.WatchedCompletion)) { model.WatchedCompletion = 0; } App.ViewModel.WatchingNow = model; if (this.LayoutRoot.Background != null) { Animation.ImageFadeIn(this.LayoutRoot.Background); } Deployment.Current.Dispatcher.BeginInvoke(new Action(() => { App.ViewModel.NotifyPropertyChanged("WatchingNow"); })); }
private void EpisodeList_ItemRealized(object sender, ItemRealizationEventArgs e) { ListItemViewModel model = (ListItemViewModel)e.Container.DataContext; model.LoadScreenImage(); }