public void Apply(WhatsOnItems whatsOnItems) { WhatsOn whatsOn = whatsOnItems.Items.FirstOrDefault<WhatsOn>(); if (whatsOn != null) { WhatsOn on2 = whatsOnItems.Items.Skip<WhatsOn>(1).FirstOrDefault<WhatsOn>(); if ((this.OnNow != null) && (this.OnNow.EpisodeID == whatsOn.EpisodeId)) { this.ApplyEpisodeInfo(this.OnNow, whatsOn); } else { AssetViewModel assetVM = new AssetViewModel { IsLive = true, IsEncrypted = true }; this.ApplyEpisodeInfo(assetVM, whatsOn); this.OnNow = assetVM; } this.OnNext = null; if (on2 != null) { if ((this.OnNext != null) && (this.OnNext.EpisodeID == on2.EpisodeId)) { this.ApplyEpisodeInfo(this.OnNext, on2); } else { AssetViewModel model3 = new AssetViewModel { IsLive = true, IsEncrypted = true }; this.ApplyEpisodeInfo(model3, on2); this.OnNext = model3; } } } }
private void ApplyEpisodeInfo(AssetViewModel assetVM, WhatsOn whatsOn) { assetVM.EpisodeID = whatsOn.EpisodeId; assetVM.ServiceID = int.Parse(whatsOn.TmsId); assetVM.Title = whatsOn.Title.Replace("&", "&"); assetVM.EpisodeName = whatsOn.EpisodeTitle.Replace("&", "&"); if (!string.IsNullOrWhiteSpace(assetVM.EpisodeName)) { assetVM.IsEpisodic = true; assetVM.SeriesTitle = assetVM.Title; } assetVM.AirDate = whatsOn.AirDateTime.Parse("yyyyMMddHHmm"); assetVM.NetworkID = whatsOn.CallSign; if (string.IsNullOrWhiteSpace(assetVM.Description)) { assetVM.Description = whatsOn.ShortDesc; } }
private void AssetInfoPanelDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { VisualStateManager.GoToState(this, "NoCoverArtUseNetworkLogo", true); if (this._assetViewModel != null) { this._assetViewModel.PropertyChanged -= new PropertyChangedEventHandler(this.AssetViewModelPropertyChanged); } AssetViewModel dataContext = base.DataContext as AssetViewModel; if (dataContext != null) { this._assetViewModel = dataContext; dataContext.PropertyChanged += new PropertyChangedEventHandler(this.AssetViewModelPropertyChanged); this.InitializeVisualStates(dataContext); } }
private void InitializeVisualStates(AssetViewModel asset) { VisualStateManager.GoToState(this, asset.IsEpisodic ? "EpisodeProgramType" : "MovieProgramType", true); VisualStateManager.GoToState(this, (asset.Year == 0) ? "NoYear" : "Year", true); VisualStateManager.GoToState(this, string.IsNullOrEmpty(asset.EpisodeName) ? "NoEpisodeName" : "EpisodeName", true); VisualStateManager.GoToState(this, string.IsNullOrEmpty(asset.Season) ? "NoSeasonAndEpisode" : "SeasonAndEpisode", true); VisualStateManager.GoToState(this, string.IsNullOrEmpty(asset.Description) ? "NoDescription" : "Description", true); if (asset.IsLive) { VisualStateManager.GoToState(this, "NoRuntime", true); } else { VisualStateManager.GoToState(this, (asset.Duration == 0) ? "NoRuntime" : "Runtime", true); } VisualStateManager.GoToState(this, string.IsNullOrEmpty(asset.Cast) ? "NoActors" : "Actors", true); VisualStateManager.GoToState(this, !asset.ExpirationDate.HasValue ? "NoExpires" : "Expires", true); VisualStateManager.GoToState(this, string.IsNullOrEmpty(asset.Director) ? "NoDirector" : "Director", true); if (string.IsNullOrEmpty(asset.Title)) { VisualStateManager.GoToState(this, "NoInfoError", true); } else if (((asset.Duration == 0) && string.IsNullOrEmpty(asset.Cast)) && (!asset.ExpirationDate.HasValue && string.IsNullOrEmpty(asset.Director))) { VisualStateManager.GoToState(this, "AssetNoMetaData", true); } else { VisualStateManager.GoToState(this, "Asset", true); } }
private void StartChannel(ChannelViewModel channelViewModel) { this.RefreshEpisodeDetailsFromNmd(); AssetViewModel onNow = channelViewModel.OnNow; if (onNow == null) { onNow = new AssetViewModel { IsLive = true, IsEncrypted = true, Title = channelViewModel.OnNowEpisodeTitle }; } onNow.ChannelTitle = channelViewModel.NetworkName; onNow.ThumbSource = channelViewModel.FirstLogo; onNow.StreamUrl = channelViewModel.SmoothStreamUrl; onNow.IsAvailableOutOfHome = channelViewModel.IsAvailableOutOfHome; base.AssetViewer.Asset = onNow; base.Interaction.DismissErrorMessage(); }
public void LoadAsset(AssetViewModel asset) { this.Asset = asset; this.CurrentLoadState = VisualStates.LoadedState; }