/// <summary> /// Navigate browser to a new page /// </summary> /// <param name="item">Item from the playlist</param> private void NavigateHomeControl(ZonePlaylistItem item) { if (item != null && item.ItemUri != null) { browser.Navigate(item.ItemUri); } }
/// <summary> /// Home control button clicked /// </summary> /// <param name="sender">Button pressed</param> /// <param name="e">Event arguments</param> void HomeControlButton_Click(object sender, RoutedEventArgs e) { int bannerIndex = (int)(sender as Button).CommandParameter; ZonePlaylistItem selection = this.HomeControlPlaylist.PlayList[bannerIndex]; this.NavigateHomeControl(selection); }
/// <summary> /// Play and item from the playlist. /// If the playlist item define a specific player, that player will be selected /// </summary> /// <param name="item">Item to play</param> private void Play(ZonePlaylistItem item) { if (this.Player != null) { this.Player.Stop(); } this.Player = PlayerManager.Create(PlayerType.axVlc, playerHost); this.Player.Play(item); }
/// <summary> /// Get item from the playlist /// </summary> /// <param name="item">Reference to a playlist</param> /// <returns>The playlist</returns> private ZonePlaylist GetPlaylistItem(ZonePlaylistItem item) { if (item == null) { // Playlist item does not exist return(null); } return(PlaylistManager.Create(item.ItemUri, true, item.ItemName)); }
/// <summary> /// Start playing the defult channel. This is first channel in default playlist /// </summary> private void InitializeDefaultPlayer() { if (this.DefaultPlaylist != null) { ZonePlaylistItem item = this.DefaultPlaylist.PlayList.FirstOrDefault(); if (item != null) { this.Play(item); } } }
/// <summary> /// Try to get item from the playlist /// </summary> /// <param name="item">Reference to a playlist</param> /// <param name="zonePlaylist">The playlist</param> /// <returns>True if the item is found</returns> private bool TryGetPlaylistItem(ZonePlaylistItem item, out ZonePlaylist zonePlaylist) { // Try to open playlist item try { zonePlaylist = this.GetPlaylistItem(item); return(true); } catch (Exception) { zonePlaylist = null; return(false); } }
/// <summary> /// Setup home control browser item /// </summary> private void InitializeHomeControl() { if (this.HomeControlPlaylist != null) { // Setup home control buttons List <Uri> banners = this.HomeControlPlaylist.PlayList.Select(element => element.BannerUri).ToList(); if (banners.Count > 0) { // Add buttons for (int inx = 0; inx < banners.Count; inx++) { Button item = CreateButton(HomeControlImageBackground, banners[inx], inx, HomeControlImageSizeHeight, HomeControlImageSizeWidth, HomeControlButton_Click); if (item != null) { homeControlList.Children.Add(item); } } } // Setup browser control ZonePlaylistItem homeControl = this.HomeControlPlaylist.PlayList.FirstOrDefault(); this.NavigateHomeControl(homeControl); } }