public void DisplayCurrentScreen(bool showBlank) { try { gridScreenControls.Visibility = Visibility.Collapsed; gridInteractiveControls.Visibility = Visibility.Collapsed; foreach (UIElement control in gridScreenControls.Children) { StopControl(control); } foreach (UIElement control in gridInteractiveControls.Children) { StopControl(control); } gridScreenControls.Children.Clear(); gridInteractiveControls.Children.Clear(); // Blank screen and exit if appropriate if (showBlank || CurrentScreen.ScreenInfo.ScreenID == 0) { return; } // Display the screen // Add the playlist if appropriate if (CurrentScreen.ScreenInfo.PlayListID != 0) { // Get the videos to display List<string> videos = new List<string>(); foreach (PlayListVideoXref xref in CurrentScreen.PlayListVideoXrefs) { if (CurrentScreen.ScreenInfo.PlayListID == xref.PlayListID) { foreach (Video video in CurrentScreen.Videos) { if (xref.VideoID == video.VideoID) { videos.Add(DownloadManager.DownloadFolder + @"Videos\" + video.StoredFilename); break; } } } } UserControls.ucPlayList ucplaylist = new UserControls.ucPlayList(); ucplaylist.Width = this.Width; ucplaylist.Height = this.Height; ucplaylist.dsVideoURLs = videos; ucplaylist.Visibility = Visibility.Visible; gridScreenControls.Children.Add(ucplaylist); ucplaylist.ResetControl(); } // Add the slideshow if appropriate if (CurrentScreen.ScreenInfo.SlideShowID != 0) { // Get the images to display List<string> images = new List<string>(); foreach (SlideShowImageXref xref in CurrentScreen.SlideShowImageXrefs) { if (CurrentScreen.ScreenInfo.SlideShowID == xref.SlideShowID) { foreach (Image image in CurrentScreen.Images) { if (xref.ImageID == image.ImageID) { images.Add(DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename); break; } } } } // Get the music to play List<string> musics = new List<string>(); foreach (SlideShowMusicXref xref in CurrentScreen.SlideShowMusicXrefs) { if (CurrentScreen.ScreenInfo.SlideShowID == xref.SlideShowID) { foreach (Music music in CurrentScreen.Musics) { if (xref.MusicID == music.MusicID) { musics.Add(DownloadManager.DownloadFolder + @"Music\" + music.StoredFilename); break; } } } } // Determine the type of slideshow to create - "Fade", "Drop From Top", "Slide From Right", "Pan Zoom", "Zoom In" SlideShow slideshow = new SlideShow(); foreach (SlideShow ss in CurrentScreen.SlideShows) { if (CurrentScreen.ScreenInfo.SlideShowID == ss.SlideShowID) slideshow = ss; } if (slideshow.TransitionType == "Drop From Top") { UserControls.ucSlideShowDropFromTop drop = new UserControls.ucSlideShowDropFromTop(); drop.Width = this.Width; drop.Height = this.Height; drop.VerticalAlignment = VerticalAlignment.Top; drop.HorizontalAlignment = HorizontalAlignment.Left; drop.dsSlideDurationInSeconds = slideshow.IntervalInSecs; drop.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); drop.dsImageURLs = images; drop.dsMusicURLs = musics; drop.dsImageFillMode = imagefillmode; drop.Visibility = Visibility.Visible; gridScreenControls.Children.Add(drop); drop.ResetControl(); } else if (slideshow.TransitionType == "Slide From Right") { UserControls.ucSlideShowSlideFromRight slide = new UserControls.ucSlideShowSlideFromRight(); slide.Width = this.Width; slide.Height = this.Height; slide.VerticalAlignment = VerticalAlignment.Top; slide.HorizontalAlignment = HorizontalAlignment.Left; slide.dsSlideDurationInSeconds = slideshow.IntervalInSecs; slide.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); slide.dsImageURLs = images; slide.dsMusicURLs = musics; slide.dsImageFillMode = imagefillmode; slide.Visibility = Visibility.Visible; gridScreenControls.Children.Add(slide); slide.ResetControl(); } else if (slideshow.TransitionType == "Pan Zoom") { UserControls.ucSlideShowPanZoom panzoom = new UserControls.ucSlideShowPanZoom(); panzoom.Width = this.Width; panzoom.Height = this.Height; panzoom.VerticalAlignment = VerticalAlignment.Top; panzoom.HorizontalAlignment = HorizontalAlignment.Left; panzoom.dsSlideDurationInSeconds = slideshow.IntervalInSecs; panzoom.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); panzoom.dsImageURLs = images; panzoom.dsMusicURLs = musics; panzoom.dsImageFillMode = imagefillmode; panzoom.Visibility = Visibility.Visible; gridScreenControls.Children.Add(panzoom); panzoom.ResetControl(); } else if (slideshow.TransitionType == "Zoom In") { UserControls.ucSlideShowZoomIn zoomin = new UserControls.ucSlideShowZoomIn(); zoomin.Width = this.Width; zoomin.Height = this.Height; zoomin.VerticalAlignment = VerticalAlignment.Top; zoomin.HorizontalAlignment = HorizontalAlignment.Left; zoomin.dsSlideDurationInSeconds = slideshow.IntervalInSecs; zoomin.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); zoomin.dsImageURLs = images; zoomin.dsMusicURLs = musics; zoomin.dsImageFillMode = imagefillmode; zoomin.Visibility = Visibility.Visible; gridScreenControls.Children.Add(zoomin); zoomin.ResetControl(); } else // Fade { UserControls.ucSlideShowFader fader = new UserControls.ucSlideShowFader(); fader.Width = this.Width; fader.Height = this.Height; fader.VerticalAlignment = VerticalAlignment.Top; fader.HorizontalAlignment = HorizontalAlignment.Left; fader.dsSlideDurationInSeconds = slideshow.IntervalInSecs; fader.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); fader.dsImageURLs = images; fader.dsMusicURLs = musics; fader.dsImageFillMode = imagefillmode; fader.Visibility = Visibility.Visible; gridScreenControls.Children.Add(fader); fader.ResetControl(); } } // Add the timeline if appropriate if (CurrentScreen.ScreenInfo.TimelineID != 0) { // Get the timeline to display Timeline timeline = new Timeline(); foreach (Timeline tl in CurrentScreen.Timelines) { if (CurrentScreen.ScreenInfo.TimelineID == tl.TimelineID) timeline = tl; } List<TimelineMedia> timelinemedia = new List<TimelineMedia>(); // Get the videos to display foreach (TimelineVideoXref xref in CurrentScreen.TimelineVideoXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Video video in CurrentScreen.Videos) { if (xref.VideoID == video.VideoID) { TimelineMedia tlm = new TimelineMedia(); tlm.StoredFilename = DownloadManager.DownloadFolder + @"Videos\" + video.StoredFilename; tlm.DisplayOrder = xref.DisplayOrder; timelinemedia.Add(tlm); break; } } } } // Get the images to display List<string> images = new List<string>(); foreach (TimelineImageXref xref in CurrentScreen.TimelineImageXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Image image in CurrentScreen.Images) { if (xref.ImageID == image.ImageID) { TimelineMedia tlm = new TimelineMedia(); tlm.StoredFilename = DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename; tlm.DisplayOrder = xref.DisplayOrder; timelinemedia.Add(tlm); break; } } } } timelinemedia.Sort(delegate(TimelineMedia tlm1, TimelineMedia tlm2) { return tlm1.DisplayOrder.CompareTo(tlm2.DisplayOrder); }); List<string> tlmedia = new List<string>(); foreach (TimelineMedia tlm in timelinemedia) { tlmedia.Add(tlm.StoredFilename); } // Get the music to play List<string> musics = new List<string>(); foreach (TimelineMusicXref xref in CurrentScreen.TimelineMusicXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Music music in CurrentScreen.Musics) { if (xref.MusicID == music.MusicID) { musics.Add(DownloadManager.DownloadFolder + @"Music\" + music.StoredFilename); break; } } } } UserControls.ucTimeline uctimeline = new UserControls.ucTimeline(); uctimeline.Width = this.Width; uctimeline.Height = this.Height; uctimeline.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); uctimeline.dsMediaURLs = tlmedia; uctimeline.dsMusicURLs = musics; uctimeline.dsFireCompleteEvent = false; uctimeline.dsMuteMusicOnPlayback = timeline.MuteMusicOnPlayback; uctimeline.dsSlideDurationInSeconds = timeline.DurationInSecs; uctimeline.Visibility = Visibility.Visible; gridScreenControls.Children.Add(uctimeline); uctimeline.ResetControl(); } // Add the interactive controls if (CurrentScreen.ScreenInfo.IsInteractive) { string imagepath = String.Empty; // Add the Interactive button foreach (Image image in CurrentSchedule.Images) { if (CurrentScreen.ScreenInfo.ButtonImageID == image.ImageID) imagepath = DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename; } System.Windows.Controls.Image interactivebutton = new System.Windows.Controls.Image(); interactivebutton.Source = new BitmapImage(new Uri(imagepath)); interactivebutton.Stretch = Stretch.Fill; interactivebutton.Width = 225; interactivebutton.Height = 80; interactivebutton.VerticalAlignment = VerticalAlignment.Bottom; interactivebutton.HorizontalAlignment = HorizontalAlignment.Right; interactivebutton.Margin = new Thickness(0, 0, 30, 30); interactivebutton.MouseLeftButtonDown += new MouseButtonEventHandler(interactivebutton_MouseLeftButtonDown); gridScreenControls.Children.Add(interactivebutton); // Add the Selection Bar selectionbar = new UserControls.ucSelectionBar(); if (this.Width < 1280) selectionbar.Width = 1280; else selectionbar.Width = this.Width; selectionbar.Height = 380; selectionbar.VerticalAlignment = VerticalAlignment.Center; selectionbar.HorizontalAlignment = HorizontalAlignment.Center; selectionbar.dsBackgroundColor = System.Windows.Media.Color.FromArgb(196, 0, 0, 0); selectionbar.dsMainWindowWidth = this.Width; List<string> captions = new List<string>(); List<string> thumbnails = new List<string>(); foreach (ScreenContent sc in CurrentScreen.ScreenContents) { captions.Add(sc.ScreenContentTitle); foreach (Image image in CurrentScreen.Images) { if (sc.ThumbnailImageID == image.ImageID) { thumbnails.Add(DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename); break; } } } selectionbar.dsImageCaptions = captions; selectionbar.dsImageURLs = thumbnails; selectionbar.Visibility = Visibility.Collapsed; gridScreenControls.Children.Add(selectionbar); selectionbar.SelectionBarClosed += new RoutedEventHandler(selectionbar_SelectionBarClosed); selectionbar.SelectionBarComplete += new RoutedEventHandler(selectionbar_SelectionBarComplete); selectionbar.ResetControl(); } gridScreenControls.Visibility = Visibility.Visible; } catch { } }
private void DisplayScreenContent(int selectedindex) { try { contenttimer.Stop(); // Screen Contents should be displayed 'On Demand' and not pre-loaded if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000000) // Image { lastcontentcontroltype = "Image"; string imagepath = String.Empty; foreach (Image image in CurrentSchedule.Images) { if (Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1) == image.ImageID) { imagepath = DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename; break; } } System.Windows.Controls.Image img = new System.Windows.Controls.Image(); img.Width = this.Width; img.Height = this.Height; img.Source = new BitmapImage(new Uri(imagepath)); img.Stretch = Stretch.Fill; img.VerticalAlignment = VerticalAlignment.Center; img.HorizontalAlignment = HorizontalAlignment.Center; gridContent.Children.Add(img); ContentFadeIn(); gridClose.Visibility = Visibility.Visible; contenttimer.Start(); } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000001) // SlideShow { int slideshowid = Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1); // Get the images to display List<string> images = new List<string>(); foreach (SlideShowImageXref xref in CurrentScreen.SlideShowImageXrefs) { if (slideshowid == xref.SlideShowID) { foreach (Image image in CurrentScreen.Images) { if (xref.ImageID == image.ImageID) { images.Add(DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename); break; } } } } // Get the music to play List<string> musics = new List<string>(); foreach (SlideShowMusicXref xref in CurrentScreen.SlideShowMusicXrefs) { if (slideshowid == xref.SlideShowID) { foreach (Music music in CurrentScreen.Musics) { if (xref.MusicID == music.MusicID) { musics.Add(DownloadManager.DownloadFolder + @"Music\" + music.StoredFilename); break; } } } } // Determine the type of slideshow to create - "Fade", "Drop From Top", "Slide From Right", "Pan Zoom", "Zoom In" SlideShow slideshow = new SlideShow(); foreach (SlideShow ss in CurrentScreen.SlideShows) { if (slideshowid == ss.SlideShowID) slideshow = ss; } if (slideshow.TransitionType == "Drop From Top") { lastcontentcontroltype = "ucSlideShowDropFromTop"; UserControls.ucSlideShowDropFromTop drop = new UserControls.ucSlideShowDropFromTop(); drop.Width = this.Width; drop.Height = this.Height; drop.VerticalAlignment = VerticalAlignment.Top; drop.HorizontalAlignment = HorizontalAlignment.Left; drop.dsSlideDurationInSeconds = slideshow.IntervalInSecs; drop.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); drop.dsImageURLs = images; drop.dsMusicURLs = musics; drop.dsImageFillMode = imagefillmode; drop.dsFireCompleteEvent = true; drop.SlideShowComplete += new RoutedEventHandler(slideshow_SlideShowComplete); drop.Visibility = Visibility.Visible; gridContent.Children.Add(drop); drop.ResetControl(); } else if (slideshow.TransitionType == "Slide From Right") { lastcontentcontroltype = "ucSlideShowSlideFromRight"; UserControls.ucSlideShowSlideFromRight slide = new UserControls.ucSlideShowSlideFromRight(); slide.Width = this.Width; slide.Height = this.Height; slide.VerticalAlignment = VerticalAlignment.Top; slide.HorizontalAlignment = HorizontalAlignment.Left; slide.dsSlideDurationInSeconds = slideshow.IntervalInSecs; slide.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); slide.dsImageURLs = images; slide.dsMusicURLs = musics; slide.dsImageFillMode = imagefillmode; slide.dsFireCompleteEvent = true; slide.SlideShowComplete += new RoutedEventHandler(slideshow_SlideShowComplete); slide.Visibility = Visibility.Visible; gridContent.Children.Add(slide); slide.ResetControl(); } else if (slideshow.TransitionType == "Pan Zoom") { lastcontentcontroltype = "ucSlideShowPanZoom"; UserControls.ucSlideShowPanZoom panzoom = new UserControls.ucSlideShowPanZoom(); panzoom.Width = this.Width; panzoom.Height = this.Height; panzoom.VerticalAlignment = VerticalAlignment.Top; panzoom.HorizontalAlignment = HorizontalAlignment.Left; panzoom.dsSlideDurationInSeconds = slideshow.IntervalInSecs; panzoom.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); panzoom.dsImageURLs = images; panzoom.dsMusicURLs = musics; panzoom.dsImageFillMode = imagefillmode; panzoom.dsFireCompleteEvent = true; panzoom.SlideShowComplete += new RoutedEventHandler(slideshow_SlideShowComplete); panzoom.Visibility = Visibility.Visible; gridContent.Children.Add(panzoom); panzoom.ResetControl(); } else if (slideshow.TransitionType == "Zoom In") { lastcontentcontroltype = "ucSlideShowZoomIn"; UserControls.ucSlideShowZoomIn zoomin = new UserControls.ucSlideShowZoomIn(); zoomin.Width = this.Width; zoomin.Height = this.Height; zoomin.VerticalAlignment = VerticalAlignment.Top; zoomin.HorizontalAlignment = HorizontalAlignment.Left; zoomin.dsSlideDurationInSeconds = slideshow.IntervalInSecs; zoomin.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); zoomin.dsImageURLs = images; zoomin.dsMusicURLs = musics; zoomin.dsImageFillMode = imagefillmode; zoomin.dsFireCompleteEvent = true; zoomin.SlideShowComplete += new RoutedEventHandler(slideshow_SlideShowComplete); zoomin.Visibility = Visibility.Visible; gridContent.Children.Add(zoomin); zoomin.ResetControl(); } else // Fade { lastcontentcontroltype = "ucSlideShowFader"; UserControls.ucSlideShowFader fader = new UserControls.ucSlideShowFader(); fader.Width = this.Width; fader.Height = this.Height; fader.VerticalAlignment = VerticalAlignment.Top; fader.HorizontalAlignment = HorizontalAlignment.Left; fader.dsSlideDurationInSeconds = slideshow.IntervalInSecs; fader.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); fader.dsImageURLs = images; fader.dsMusicURLs = musics; fader.dsImageFillMode = imagefillmode; fader.dsFireCompleteEvent = true; fader.SlideShowComplete += new RoutedEventHandler(slideshow_SlideShowComplete); fader.Visibility = Visibility.Visible; gridContent.Children.Add(fader); fader.ResetControl(); } ContentFadeIn(); gridClose.Visibility = Visibility.Visible; } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000002) // Video { lastcontentcontroltype = "Video"; int videoid = Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1); // Get the videos to display List<string> videos = new List<string>(); foreach (Video video in CurrentScreen.Videos) { if (videoid == video.VideoID) { videos.Add(DownloadManager.DownloadFolder + @"Videos\" + video.StoredFilename); break; } } UserControls.ucPlayList ucplaylist = new UserControls.ucPlayList(); ucplaylist.Width = this.Width; ucplaylist.Height = this.Height; ucplaylist.dsVideoURLs = videos; ucplaylist.dsFireCompleteEvent = true; ucplaylist.PlayListComplete += new RoutedEventHandler(ucplaylist_PlayListComplete); ucplaylist.Visibility = Visibility.Visible; gridContent.Children.Add(ucplaylist); ucplaylist.ResetControl(); ContentFadeIn(); gridClose.Visibility = Visibility.Visible; } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000003) // PlayList { lastcontentcontroltype = "ucPlayList"; int playlistid = Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1); // Get the videos to display List<string> videos = new List<string>(); foreach (PlayListVideoXref xref in CurrentScreen.PlayListVideoXrefs) { if (playlistid == xref.PlayListID) { foreach (Video video in CurrentScreen.Videos) { if (xref.VideoID == video.VideoID) { videos.Add(DownloadManager.DownloadFolder + @"Videos\" + video.StoredFilename); break; } } } } UserControls.ucPlayList ucplaylist = new UserControls.ucPlayList(); ucplaylist.Width = this.Width; ucplaylist.Height = this.Height; ucplaylist.dsVideoURLs = videos; ucplaylist.dsFireCompleteEvent = true; ucplaylist.PlayListComplete += new RoutedEventHandler(ucplaylist_PlayListComplete); ucplaylist.Visibility = Visibility.Visible; gridContent.Children.Add(ucplaylist); ucplaylist.ResetControl(); ContentFadeIn(); gridClose.Visibility = Visibility.Visible; } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000004) // Web Site { lastcontentcontroltype = "ucWeb"; string website = CurrentScreen.ScreenContents[selectedindex].CustomField1; UserControls.ucWeb ucweb = new UserControls.ucWeb(); ucweb.Width = this.Width; ucweb.Height = this.Height; ucweb.VerticalAlignment = VerticalAlignment.Top; ucweb.HorizontalAlignment = HorizontalAlignment.Left; ucweb.Margin = new Thickness(0, 0, 0, 0); ucweb.dsWebsiteUrl = website; ucweb.ResetControl(); ucweb.Visibility = Visibility.Visible; gridContent.Children.Add(ucweb); ContentFadeIn(); gridClose.Visibility = Visibility.Visible; contenttimer.Start(); } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000007) // Survey { // Unlike the other controls, the survey control is not in the controls library int surveyid = Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1); // Assign the appropriate survey, questions, and options to the control foreach (Survey survey in CurrentScreen.Surveys) { if (survey.SurveyID == surveyid) ucSurvey.dsSurvey = survey; } ucSurvey.dsSurveyQuestions = new List<SurveyQuestion>(); ucSurvey.dsSurveyQuestionOptions = new List<SurveyQuestionOption>(); foreach (SurveyQuestion question in CurrentScreen.SurveyQuestions) { if (question.SurveyID == ucSurvey.dsSurvey.SurveyID) ucSurvey.dsSurveyQuestions.Add(question); } foreach (SurveyQuestion question in ucSurvey.dsSurveyQuestions) { foreach (SurveyQuestionOption option in CurrentScreen.SurveyQuestionOptions) { if (option.SurveyQuestionID == question.SurveyQuestionID) ucSurvey.dsSurveyQuestionOptions.Add(option); } } ucSurvey.ResetControl(); ucSurvey.FadeIn(); } else if (CurrentScreen.ScreenContents[selectedindex].ScreenContentTypeID == 1000008) // Timeline { lastcontentcontroltype = "ucTimeline"; int timelineid = Convert.ToInt32(CurrentScreen.ScreenContents[selectedindex].CustomField1); // Get the timeline to display Timeline timeline = new Timeline(); foreach (Timeline tl in CurrentScreen.Timelines) { if (CurrentScreen.ScreenInfo.TimelineID == tl.TimelineID) timeline = tl; } List<TimelineMedia> timelinemedia = new List<TimelineMedia>(); // Get the videos to display foreach (TimelineVideoXref xref in CurrentScreen.TimelineVideoXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Video video in CurrentScreen.Videos) { if (xref.VideoID == video.VideoID) { TimelineMedia tlm = new TimelineMedia(); tlm.StoredFilename = DownloadManager.DownloadFolder + @"Videos\" + video.StoredFilename; tlm.DisplayOrder = xref.DisplayOrder; timelinemedia.Add(tlm); break; } } } } // Get the images to display List<string> images = new List<string>(); foreach (TimelineImageXref xref in CurrentScreen.TimelineImageXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Image image in CurrentScreen.Images) { if (xref.ImageID == image.ImageID) { TimelineMedia tlm = new TimelineMedia(); tlm.StoredFilename = DownloadManager.DownloadFolder + @"Images\" + image.StoredFilename; tlm.DisplayOrder = xref.DisplayOrder; timelinemedia.Add(tlm); break; } } } } timelinemedia.Sort(delegate(TimelineMedia tlm1, TimelineMedia tlm2) { return tlm1.DisplayOrder.CompareTo(tlm2.DisplayOrder); }); List<string> tlmedia = new List<string>(); foreach (TimelineMedia tlm in timelinemedia) { tlmedia.Add(tlm.StoredFilename); } // Get the music to play List<string> musics = new List<string>(); foreach (TimelineMusicXref xref in CurrentScreen.TimelineMusicXrefs) { if (CurrentScreen.ScreenInfo.TimelineID == xref.TimelineID) { foreach (Music music in CurrentScreen.Musics) { if (xref.MusicID == music.MusicID) { musics.Add(DownloadManager.DownloadFolder + @"Music\" + music.StoredFilename); break; } } } } UserControls.ucTimeline uctimeline = new UserControls.ucTimeline(); uctimeline.Width = this.Width; uctimeline.Height = this.Height; uctimeline.dsBackgroundColor = System.Windows.Media.Color.FromArgb(255, 0, 0, 0); uctimeline.dsMediaURLs = tlmedia; uctimeline.dsMusicURLs = musics; uctimeline.dsFireCompleteEvent = true; uctimeline.dsMuteMusicOnPlayback = timeline.MuteMusicOnPlayback; uctimeline.dsSlideDurationInSeconds = timeline.DurationInSecs; uctimeline.Visibility = Visibility.Visible; uctimeline.TimelineComplete += uctimeline_TimelineComplete; gridContent.Children.Add(uctimeline); uctimeline.ResetControl(); ContentFadeIn(); gridClose.Visibility = Visibility.Visible; } // Create the screen content log CreateScreenContentLog(selectedindex); } catch { } }
public static void ParseScheduleXml(string xml) { try { // Get the PlayerGroupSchedule(s) try { List <PlayerGroupSchedule> pgs = new List <PlayerGroupSchedule>(); XDocument xmldoc = XDocument.Parse(xml); pgs = (from PlayerGroupSchedule in xmldoc.Descendants("PlayerGroupSchedule") select new PlayerGroupSchedule { PlayerGroupScheduleID = Convert.ToInt32(PlayerGroupSchedule.Attribute("PlayerGroupScheduleID").Value), PlayerGroupID = Convert.ToInt32(PlayerGroupSchedule.Attribute("PlayerGroupID").Value), ScreenID = Convert.ToInt32(PlayerGroupSchedule.Attribute("ScreenID").Value), Day = Convert.ToInt32(PlayerGroupSchedule.Attribute("Day").Value), Hour = Convert.ToInt32(PlayerGroupSchedule.Attribute("Hour").Value), Minute = Convert.ToInt32(PlayerGroupSchedule.Attribute("Minute").Value), } ).ToList(); PlayerGroupSchedules = pgs; } catch { } // Parse out the Screens try { List <Screen> ss = new List <Screen>(); XDocument xmldoc = XDocument.Parse(xml); ss = (from Screen in xmldoc.Descendants("Screen") select new Screen { ScreenID = Convert.ToInt32(Screen.Attribute("ScreenID").Value), AccountID = Convert.ToInt32(Screen.Attribute("AccountID").Value), ScreenName = Utility.DecodeXMLString(Convert.ToString(Screen.Attribute("ScreenName").Value)), PlayListID = Convert.ToInt32(Screen.Attribute("PlayListID").Value), SlideShowID = Convert.ToInt32(Screen.Attribute("SlideShowID").Value), TimelineID = Convert.ToInt32(Screen.Attribute("TimelineID").Value), ButtonImageID = Convert.ToInt32(Screen.Attribute("ButtonImageID").Value), IsInteractive = Convert.ToBoolean(Screen.Attribute("IsInteractive").Value), } ).ToList(); Screens = ss; } catch { } // Parse out the ScreenScreenContentXrefs try { List <ScreenScreenContentXref> sscxrefs = new List <ScreenScreenContentXref>(); XDocument xmldoc = XDocument.Parse(xml); sscxrefs = (from ScreenScreenContentXref in xmldoc.Descendants("ScreenScreenContentXref") select new ScreenScreenContentXref { ScreenScreenContentXrefID = Convert.ToInt32(ScreenScreenContentXref.Attribute("ScreenScreenContentXrefID").Value), ScreenID = Convert.ToInt32(ScreenScreenContentXref.Attribute("ScreenID").Value), ScreenContentID = Convert.ToInt32(ScreenScreenContentXref.Attribute("ScreenContentID").Value), DisplayOrder = Convert.ToInt32(ScreenScreenContentXref.Attribute("ScreenID").Value), } ).ToList(); ScreenScreenContentXrefs = sscxrefs; } catch { } // Parse out the ScreenContents try { List <ScreenContent> scs = new List <ScreenContent>(); XDocument xmldoc = XDocument.Parse(xml); scs = (from ScreenContent in xmldoc.Descendants("ScreenContent") select new ScreenContent { ScreenContentID = Convert.ToInt32(ScreenContent.Attribute("ScreenContentID").Value), ScreenContentTypeID = Convert.ToInt32(ScreenContent.Attribute("ScreenContentTypeID").Value), ScreenContentTypeName = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("ScreenContentTypeName").Value)), ScreenContentName = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("ScreenContentName").Value)), ScreenContentTitle = Convert.ToString(ScreenContent.Attribute("ScreenContentTitle").Value), ThumbnailImageID = Convert.ToInt32(ScreenContent.Attribute("ThumbnailImageID").Value), CustomField1 = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("CustomField1").Value)), CustomField2 = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("CustomField2").Value)), CustomField3 = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("CustomField3").Value)), CustomField4 = Utility.DecodeXMLString(Convert.ToString(ScreenContent.Attribute("CustomField4").Value)), } ).ToList(); ScreenContents = scs; } catch { } // Parse out the SlideShows try { List <SlideShow> sss = new List <SlideShow>(); XDocument xmldoc = XDocument.Parse(xml); sss = (from SlideShow in xmldoc.Descendants("SlideShow") select new SlideShow { SlideShowID = Convert.ToInt32(SlideShow.Attribute("SlideShowID").Value), IntervalInSecs = Convert.ToInt32(SlideShow.Attribute("IntervalInSecs").Value), TransitionType = Utility.DecodeXMLString(Convert.ToString(SlideShow.Attribute("TransitionType").Value)), } ).ToList(); SlideShows = sss; } catch { } // Parse out the SlideShowImageXrefs try { List <SlideShowImageXref> ssis = new List <SlideShowImageXref>(); XDocument xmldoc = XDocument.Parse(xml); ssis = (from SlideShowImageXref in xmldoc.Descendants("SlideShowImageXref") select new SlideShowImageXref { SlideShowImageXrefID = Convert.ToInt32(SlideShowImageXref.Attribute("SlideShowImageXrefID").Value), SlideShowID = Convert.ToInt32(SlideShowImageXref.Attribute("SlideShowID").Value), ImageID = Convert.ToInt32(SlideShowImageXref.Attribute("ImageID").Value), PlayOrder = Convert.ToInt32(SlideShowImageXref.Attribute("PlayOrder").Value), } ).ToList(); SlideShowImageXrefs = ssis; } catch { } // Parse out the SlideShowMusicXrefs try { List <SlideShowMusicXref> ssms = new List <SlideShowMusicXref>(); XDocument xmldoc = XDocument.Parse(xml); ssms = (from SlideShowMusicXref in xmldoc.Descendants("SlideShowMusicXref") select new SlideShowMusicXref { SlideShowMusicXrefID = Convert.ToInt32(SlideShowMusicXref.Attribute("SlideShowMusicXrefID").Value), SlideShowID = Convert.ToInt32(SlideShowMusicXref.Attribute("SlideShowID").Value), MusicID = Convert.ToInt32(SlideShowMusicXref.Attribute("MusicID").Value), PlayOrder = Convert.ToInt32(SlideShowMusicXref.Attribute("PlayOrder").Value), } ).ToList(); SlideShowMusicXrefs = ssms; } catch { } // Parse out the Timelines try { List <Timeline> tls = new List <Timeline>(); XDocument xmldoc = XDocument.Parse(xml); tls = (from Timeline in xmldoc.Descendants("Timeline") select new Timeline { TimelineID = Convert.ToInt32(Timeline.Attribute("TimelineID").Value), DurationInSecs = Convert.ToInt32(Timeline.Attribute("DurationInSecs").Value), MuteMusicOnPlayback = Convert.ToBoolean(Timeline.Attribute("MuteMusicOnPlayback").Value), } ).ToList(); Timelines = tls; } catch { } // Parse out the TimelineImageXrefs try { List <TimelineImageXref> tlis = new List <TimelineImageXref>(); XDocument xmldoc = XDocument.Parse(xml); tlis = (from TimelineImageXref in xmldoc.Descendants("TimelineImageXref") select new TimelineImageXref { TimelineImageXrefID = Convert.ToInt32(TimelineImageXref.Attribute("TimelineImageXrefID").Value), TimelineID = Convert.ToInt32(TimelineImageXref.Attribute("TimelineID").Value), ImageID = Convert.ToInt32(TimelineImageXref.Attribute("ImageID").Value), DisplayOrder = Convert.ToInt32(TimelineImageXref.Attribute("DisplayOrder").Value), } ).ToList(); TimelineImageXrefs = tlis; } catch { } // Parse out the TimelineMusicXrefs try { List <TimelineMusicXref> tlms = new List <TimelineMusicXref>(); XDocument xmldoc = XDocument.Parse(xml); tlms = (from TimelineMusicXref in xmldoc.Descendants("TimelineMusicXref") select new TimelineMusicXref { TimelineMusicXrefID = Convert.ToInt32(TimelineMusicXref.Attribute("TimelineMusicXrefID").Value), TimelineID = Convert.ToInt32(TimelineMusicXref.Attribute("TimelineID").Value), MusicID = Convert.ToInt32(TimelineMusicXref.Attribute("MusicID").Value), PlayOrder = Convert.ToInt32(TimelineMusicXref.Attribute("PlayOrder").Value), } ).ToList(); TimelineMusicXrefs = tlms; } catch { } // Parse out the TimelineVideoXrefs try { List <TimelineVideoXref> tlvs = new List <TimelineVideoXref>(); XDocument xmldoc = XDocument.Parse(xml); tlvs = (from TimelineVideoXref in xmldoc.Descendants("TimelineVideoXref") select new TimelineVideoXref { TimelineVideoXrefID = Convert.ToInt32(TimelineVideoXref.Attribute("TimelineVideoXrefID").Value), TimelineID = Convert.ToInt32(TimelineVideoXref.Attribute("TimelineID").Value), VideoID = Convert.ToInt32(TimelineVideoXref.Attribute("VideoID").Value), DisplayOrder = Convert.ToInt32(TimelineVideoXref.Attribute("DisplayOrder").Value), } ).ToList(); TimelineVideoXrefs = tlvs; } catch { } // Parse out the Images try { List <Image> images = new List <Image>(); XDocument xmldoc = XDocument.Parse(xml); images = (from Image in xmldoc.Descendants("Image") select new Image { ImageID = Convert.ToInt32(Image.Attribute("ImageID").Value), StoredFilename = Convert.ToString(Image.Attribute("StoredFilename").Value), ImageName = Utility.DecodeXMLString(Image.Attribute("ImageName").Value), } ).ToList(); Images = images; } catch { } // Parse out the Musics try { List <Music> musics = new List <Music>(); XDocument xmldoc = XDocument.Parse(xml); musics = (from Music in xmldoc.Descendants("Music") select new Music { MusicID = Convert.ToInt32(Music.Attribute("MusicID").Value), StoredFilename = Convert.ToString(Music.Attribute("StoredFilename").Value), MusicName = Utility.DecodeXMLString(Music.Attribute("MusicName").Value), } ).ToList(); Musics = musics; } catch { } // Parse out the PlayLists try { List <PlayList> pls = new List <PlayList>(); XDocument xmldoc = XDocument.Parse(xml); pls = (from PlayList in xmldoc.Descendants("PlayList") select new PlayList { PlayListID = Convert.ToInt32(PlayList.Attribute("PlayListID").Value), } ).ToList(); PlayLists = pls; } catch { } // Parse out the PlayListVideoXrefs try { List <PlayListVideoXref> plvs = new List <PlayListVideoXref>(); XDocument xmldoc = XDocument.Parse(xml); plvs = (from PlayListVideoXref in xmldoc.Descendants("PlayListVideoXref") select new PlayListVideoXref { PlayListVideoXrefID = Convert.ToInt32(PlayListVideoXref.Attribute("PlayListVideoXrefID").Value), PlayListID = Convert.ToInt32(PlayListVideoXref.Attribute("PlayListID").Value), VideoID = Convert.ToInt32(PlayListVideoXref.Attribute("VideoID").Value), PlayOrder = Convert.ToInt32(PlayListVideoXref.Attribute("PlayOrder").Value), } ).ToList(); PlayListVideoXrefs = plvs; } catch { } // Parse out the Videos try { List <Video> videos = new List <Video>(); XDocument xmldoc = XDocument.Parse(xml); videos = (from Video in xmldoc.Descendants("Video") select new Video { VideoID = Convert.ToInt32(Video.Attribute("VideoID").Value), StoredFilename = Convert.ToString(Video.Attribute("StoredFilename").Value), VideoName = Utility.DecodeXMLString(Convert.ToString(Video.Attribute("VideoName").Value)), } ).ToList(); Videos = videos; } catch { } // Parse out the Surveys try { List <Survey> surveys = new List <Survey>(); XDocument xmldoc = XDocument.Parse(xml); surveys = (from Survey in xmldoc.Descendants("Survey") select new Survey { SurveyID = Convert.ToInt32(Survey.Attribute("SurveyID").Value), SurveyName = Utility.DecodeXMLString(Convert.ToString(Survey.Attribute("SurveyName").Value)), SurveyImageID = Convert.ToInt32(Survey.Attribute("SurveyImageID").Value), } ).ToList(); Surveys = surveys; } catch { } // Parse out the SurveyQuestions try { List <SurveyQuestion> questions = new List <SurveyQuestion>(); XDocument xmldoc = XDocument.Parse(xml); questions = (from SurveyQuestion in xmldoc.Descendants("SurveyQuestion") select new SurveyQuestion { SurveyQuestionID = Convert.ToInt32(SurveyQuestion.Attribute("SurveyQuestionID").Value), SurveyID = Convert.ToInt32(SurveyQuestion.Attribute("SurveyID").Value), SurveyQuestionText = Utility.DecodeXMLString(Convert.ToString(SurveyQuestion.Attribute("SurveyQuestionText").Value)), AllowMultiselect = Convert.ToBoolean(SurveyQuestion.Attribute("AllowMultiselect").Value), SortOrder = Convert.ToInt32(SurveyQuestion.Attribute("SortOrder").Value), } ).ToList(); SurveyQuestions = questions; } catch { } // Parse out the SurveyQuestionOptions try { List <SurveyQuestionOption> options = new List <SurveyQuestionOption>(); XDocument xmldoc = XDocument.Parse(xml); options = (from SurveyQuestionOption in xmldoc.Descendants("SurveyQuestionOption") select new SurveyQuestionOption { SurveyQuestionOptionID = Convert.ToInt32(SurveyQuestionOption.Attribute("SurveyQuestionOptionID").Value), SurveyQuestionID = Convert.ToInt32(SurveyQuestionOption.Attribute("SurveyQuestionID").Value), SurveyQuestionOptionText = Utility.DecodeXMLString(Convert.ToString(SurveyQuestionOption.Attribute("SurveyQuestionOptionText").Value)), SortOrder = Convert.ToInt32(SurveyQuestionOption.Attribute("SortOrder").Value), } ).ToList(); SurveyQuestionOptions = options; } catch { } // Parse out the PlayerSettings try { List <PlayerSetting> settings = new List <PlayerSetting>(); XDocument xmldoc = XDocument.Parse(xml); settings = (from PlayerSetting in xmldoc.Descendants("PlayerSetting") select new PlayerSetting { PlayerSettingName = Utility.DecodeXMLString(Convert.ToString(PlayerSetting.Attribute("PlayerSettingName").Value)), PlayerSettingTypeID = Convert.ToInt32(PlayerSetting.Attribute("PlayerSettingTypeID").Value), PlayerSettingValue = Utility.DecodeXMLString(Convert.ToString(PlayerSetting.Attribute("PlayerSettingValue").Value)), } ).ToList(); PlayerSettings = settings; osVodigiPlayer.Helpers.PlayerSettings.AllPlayerSettings = settings; } catch { } } catch { } }