コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: CivilPol/Vodigi
        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 { }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: CivilPol/Vodigi
        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 { }
        }