コード例 #1
0
 /// <summary>
 /// Method to create or modify the screen content for a given tile
 /// </summary>
 /// <param name="tileID"></param>
 /// <returns></returns>
 public bool CreateOrUpdateScreenContent(String tileID, ScreenContent content)
 {
     if (ScreenContents.ContainsKey(tileID))
     {
         //Update
         ScreenContents[tileID].Id        = tileID;
         ScreenContents[tileID].Content   = content.Content;
         ScreenContents[tileID].Header    = content.Header;
         ScreenContents[tileID].LoopVideo = content.LoopVideo;
         ScreenContents[tileID].Type      = content.Type;
     }
     else
     {
         //Create
         ScreenContents.Add(tileID, content);
     }
     return(true);
 }
コード例 #2
0
ファイル: Screen.cs プロジェクト: guozanhua/kinect-ripple
 /// <summary>
 /// Method to create or modify the screen content for a given tile
 /// </summary>
 /// <param name="tileID"></param>
 /// <returns></returns>
 public bool CreateOrUpdateScreenContent(String tileID, ScreenContent content)
 {
     if (ScreenContents.ContainsKey(tileID))
     {
         //Update
         ScreenContents[tileID].Id = tileID;
         ScreenContents[tileID].Content = content.Content;
         ScreenContents[tileID].Header = content.Header;
         ScreenContents[tileID].LoopVideo = content.LoopVideo;
         ScreenContents[tileID].Type = content.Type;
     }
     else
     {
         //Create
         ScreenContents.Add(tileID, content);
     }
     return true;
 }
コード例 #3
0
        /// <summary>
        /// Gets the Screen tag from the Ripple XML.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns>RippleDictionary.Screen</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     RippleDictionary.TypeNotKnownException
        ///     RippleDictionary.UnparseableXMLException" />
        public static Screen GetScreenFromXML(string xml)
        {
            Screen    screen = null;
            XDocument xdoc   = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml));

            foreach (var xel in xdoc.Root.Elements())
            {
                if (xel.Name == XMLElementsAndAttributes.Screen)
                {
                    string type, id, header, content;
                    Dictionary <string, ScreenContent> screenContents = new Dictionary <string, ScreenContent>();
                    ScreenContent screenContent;
                    foreach (var tagContent in xel.Elements())
                    {
                        if (tagContent.Name == XMLElementsAndAttributes.ScreenContent)
                        {
                            type    = tagContent.Attribute(XMLElementsAndAttributes.Type).Value;
                            id      = tagContent.Attribute(XMLElementsAndAttributes.Id).Value;
                            header  = tagContent.Attribute(XMLElementsAndAttributes.Header).Value;
                            content = tagContent.Attribute(XMLElementsAndAttributes.Content).Value;
                            var  loopVideoObj = tagContent.Attribute(XMLElementsAndAttributes.LoopVideo);
                            bool loopVideo    = loopVideoObj != null ? (loopVideoObj.Value.ToLower() == "true" ? (bool)true : (loopVideoObj.Value.ToLower() == "false" ? (bool)false : false)) : false;

                            screenContent = new ScreenContent(GetType(type), id, header, content, loopVideo);
                            screenContents.Add(screenContent.Id, screenContent);
                        }
                    }

                    screen = new Screen(screenContents);
                }
                else
                {
                    continue;
                }
            }

            return(screen);
        }
コード例 #4
0
        private void ProjectIntroContent(RippleDictionary.ScreenContent screenContent)
        {
            try
            {
                //Dispose the previous content
                //Stop any existing projections
                DocumentPresentation.HelperMethods.StopPresentation();
                FullScreenContentGrid.Children.Clear();
                ContentGrid.Children.Clear();

                //Set focus for screen window also
                Utilities.Helper.ClickOnScreenToGetFocus();

                //Stop any existing videos
                loopVideo                     = false;
                VideoControl.Source           = null;
                FullScreenVideoControl.Source = null;

                //Clean the images
                fullScreenImgElement.Source = null;
                imgElement.Source           = null;

                //Clear the header text
                TitleLabel.Text = "";

                if (browserElement != null)
                {
                    browserElement.Dispose();
                }
                browserElement = null;
                if (host != null)
                {
                    host.Dispose();
                }
                host = null;
                if (helper != null)
                {
                    helper.PropertyChanged -= helper_PropertyChanged;
                }
                helper = null;

                //Play the Intro video
                this.TitleLabel.Text             = "";
                ContentGrid.Visibility           = Visibility.Collapsed;
                FullScreenContentGrid.Visibility = Visibility.Collapsed;
                FullScreenVideoGrid.Visibility   = Visibility.Collapsed;
                IntroVideoControl.Visibility     = Visibility.Visible;
                VideoControl.Visibility          = Visibility.Collapsed;
                VideoGrid.Visibility             = Visibility.Visible;
                IntroVideoControl.Play();
                this.UpdateLayout();

                myBackgroundWorker                     = new BackgroundWorker();
                myBackgroundWorker.DoWork             += myBackgroundWorker_DoWork;
                myBackgroundWorker.RunWorkerCompleted += myBackgroundWorker_RunWorkerCompleted;
                myBackgroundWorker.RunWorkerAsync(rippleData.Floor.Start.IntroVideoWaitPeriod);
            }
            catch (Exception ex)
            {
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in ProjectIntroContent Method for screen {0}", ex.Message);
            }
        }
コード例 #5
0
        /// <summary>
        /// Identifies the content type and project accordingly
        /// </summary>
        /// <param name="screenContent"></param>
        private void ProjectContent(RippleDictionary.ScreenContent screenContent)
        {
            try
            {
                if (screenContent.Type == ContentType.HTMLMessage)
                {
                    if (helper != null && currentScreenContent == ContentType.HTML)
                    {
                        helper.MessageReceived(screenContent.Content);
                        return;
                    }
                }

                //Stop any existing projections
                DocumentPresentation.HelperMethods.StopPresentation();
                FullScreenContentGrid.Children.Clear();
                ContentGrid.Children.Clear();

                //Set focus for screen window also
                Utilities.Helper.ClickOnScreenToGetFocus();

                //Stop any existing videos
                loopVideo                     = false;
                VideoControl.Source           = null;
                FullScreenVideoControl.Source = null;

                //Clean the images
                fullScreenImgElement.Source = null;
                imgElement.Source           = null;

                //Clear the header text
                TitleLabel.Text = "";

                //Dispose the objects
                if (browserElement != null)
                {
                    browserElement.Dispose();
                }
                browserElement = null;

                if (host != null)
                {
                    host.Dispose();
                }
                host = null;

                if (helper != null)
                {
                    helper.PropertyChanged -= helper_PropertyChanged;
                }
                helper = null;

                currentScreenContent = screenContent.Type;

                if (screenContent.Id == "Tile0" && StartVideoPlayed)
                {
                    currentScreenContent = ContentType.Image;
                    ShowImage("\\Assets\\Images\\default_start.png", screenContent.Header);
                    return;
                }

                switch (screenContent.Type)
                {
                case RippleDictionary.ContentType.HTML:
                    ShowBrowser(screenContent.Content, screenContent.Header);
                    break;

                case RippleDictionary.ContentType.Image:
                    ShowImage(screenContent.Content, screenContent.Header);
                    break;

                case RippleDictionary.ContentType.PPT:
                    ShowPPT(screenContent.Content, screenContent.Header);
                    break;

                case RippleDictionary.ContentType.Text:
                    ShowText(screenContent.Content, screenContent.Header);
                    break;

                case RippleDictionary.ContentType.Video:
                    loopVideo = (screenContent.LoopVideo == null) ? false : Convert.ToBoolean(screenContent.LoopVideo);
                    if (screenContent.Id == "Tile0")
                    {
                        StartVideoPlayed = true;
                    }
                    ShowVideo(screenContent.Content, screenContent.Header);
                    break;
                }
            }
            catch (Exception ex)
            {
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in ProjectContent Method for screen {0}", ex.Message);
            }
        }
コード例 #6
0
ファイル: Dictionary.cs プロジェクト: guozanhua/kinect-ripple
        /// <summary>
        /// Gets the Screen tag from the Ripple XML.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns>RippleDictionary.Screen</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     RippleDictionary.TypeNotKnownException
        ///     RippleDictionary.UnparseableXMLException" />
        public static Screen GetScreenFromXML(string xml)
        {
            Screen screen = null;
            XDocument xdoc = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml));

            foreach (var xel in xdoc.Root.Elements())
            {
                if (xel.Name == XMLElementsAndAttributes.Screen)
                {
                    
                    string type, id, header, content;
                    Dictionary<string, ScreenContent> screenContents = new Dictionary<string, ScreenContent>();
                    ScreenContent screenContent;
                    foreach (var tagContent in xel.Elements())
                    {
                        if (tagContent.Name == XMLElementsAndAttributes.ScreenContent)
                        {
                            type = tagContent.Attribute(XMLElementsAndAttributes.Type).Value;
                            id = tagContent.Attribute(XMLElementsAndAttributes.Id).Value;
                            header = tagContent.Attribute(XMLElementsAndAttributes.Header).Value;
                            content = tagContent.Attribute(XMLElementsAndAttributes.Content).Value;
                            var loopVideoObj = tagContent.Attribute(XMLElementsAndAttributes.LoopVideo);
                            bool loopVideo = loopVideoObj != null ? (loopVideoObj.Value.ToLower() == "true" ? (bool)true : (loopVideoObj.Value.ToLower() == "false" ? (bool)false : false)) : false;

                            screenContent = new ScreenContent(GetType(type), id, header, content, loopVideo);
                            screenContents.Add(screenContent.Id, screenContent);
                        }
                    }

                    screen = new Screen(screenContents); 
                    
                }
                else
                {
                    continue;
                }
            }

            return screen;
        }