Example #1
0
 public Floor(Start start, Transition transition, Dictionary<string, Tile> tiles, double _lockingPeriod, int _systemAutoLockPeriod, String _setupID, Tile upperTile)
 {
     Start = start;
     Transition = transition;
     Tiles = tiles;
     LockingPeriod = _lockingPeriod;
     SystemAutoLockPeriod = _systemAutoLockPeriod;
     SetupID = _setupID;
     UpperTile = upperTile;
 }
Example #2
0
 public void SaveFloorProperties(RippleDictionary.Tile tile)
 {
     try
     {
         //Name
         tile.Name = this.TBTextValue.Text;
         //Tile type
         tile.TileType = (RippleDictionary.TileType) this.CBTypeValue.SelectedIndex;
         //Content
         tile.Content = this.TBContentValue.Text;
         //Color
         tile.Color = this.clrPicker.SelectedColor;
         //Action Type
         tile.Action = (TileAction)this.CBActionValue.SelectedIndex;
         //Action Content
         tile.ActionURI = this.TBActionURIValue.Text;
     }
     catch (Exception ex)
     {
         RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in SaveFloorProperties for Floor Properties: {0}", ex.Message);
     }
 }
Example #3
0
        public void SetFloorProperties(RippleDictionary.Tile tile)
        {
            try
            {
                //Text
                this.TBTextValue.Text = tile.Name;

                //Color
                this.clrPicker.SelectedColor = tile.Color;

                //Tile Type
                this.CBTypeValue.SelectedValue = tile.TileType.ToString();

                //Tile content
                if ((!String.IsNullOrEmpty(tile.Content)) && (tile.Content.StartsWith(@"\Assets\")))
                {
                    this.TBContentValue.Text = Utilities.HelperMethods.TargetAssetsRoot + tile.Content;
                }
                else
                {
                    this.TBContentValue.Text = tile.Content;
                }

                //Action type
                this.CBActionValue.SelectedValue = tile.Action.ToString();

                //Action content
                if ((!String.IsNullOrEmpty(tile.ActionURI)) && (tile.ActionURI.StartsWith(@"\Assets\")))
                {
                    this.TBActionURIValue.Text = Utilities.HelperMethods.TargetAssetsRoot + tile.ActionURI;
                }
                else
                {
                    this.TBActionURIValue.Text = tile.ActionURI;
                }

                //UI settings
                //Content browse button
                if (CBTypeValue.SelectedValue.ToString().Equals(RippleDictionary.TileType.Text.ToString()))
                {
                    this.ContentBrowseButton.IsEnabled = false;
                }
                else
                {
                    this.ContentBrowseButton.IsEnabled = true;
                }

                //Action URI browse button and textbox
                if (CBActionValue.SelectedValue.ToString().Equals(TileAction.HTML.ToString()))
                {
                    this.ActionURIBrowseButton.IsEnabled         = true;
                    this.TBActionURIValue.IsReadOnly             = true;
                    this.TBActionURIValue.IsReadOnlyCaretVisible = true;
                }
                else if (CBActionValue.SelectedValue.ToString().Equals(TileAction.QRCode.ToString()))
                {
                    this.ActionURIBrowseButton.IsEnabled         = false;
                    this.TBActionURIValue.IsReadOnly             = false;
                    this.TBActionURIValue.IsReadOnlyCaretVisible = false;
                }
                else
                {
                    this.ActionURIBrowseButton.IsEnabled         = false;
                    this.TBActionURIValue.IsReadOnly             = true;
                    this.TBActionURIValue.IsReadOnlyCaretVisible = true;
                }

                //Custom disablement for start
                if (tile.Id.Equals("Tile0"))
                {
                    this.TBTextValue.IsEnabled   = false;
                    this.CBTypeValue.IsEnabled   = false;
                    this.CBActionValue.IsEnabled = false;
                }
                else
                {
                    this.TBTextValue.IsEnabled   = true;
                    this.CBTypeValue.IsEnabled   = true;
                    this.CBActionValue.IsEnabled = true;
                }
            }
            catch (Exception ex)
            {
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in SetFloorProperties for Floor Properties: {0}", ex.Message);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tile"></param>
        /// <returns></returns>
        private static XElement GetXElementTile(Tile tile)
        {
            XAttribute eId, eName, eTileType, eColor, eStyle, eCoordinate, eAction, eActionURI, eContent, eCorrespondingScreenContentType;
            List<XElement> eSubTiles = new List<XElement>();
            string id = null, appendSub = null;

            id = tile.Id;
            appendSub = null;
            eId = new XAttribute(XMLElementsAndAttributes.Id, tile.Id);
            eName = new XAttribute(XMLElementsAndAttributes.Name, tile.Name);
            eTileType = new XAttribute(XMLElementsAndAttributes.TileType, tile.TileType.ToString());
            if (tile.Content != null)
                eContent = new XAttribute(XMLElementsAndAttributes.Content, tile.Content);
            else
                eContent = null;
            if (tile.CorrespondingScreenContentType != null)
                eCorrespondingScreenContentType = new XAttribute(XMLElementsAndAttributes.CorrespondingScreenContentType, tile.CorrespondingScreenContentType.ToString());
            else
                eCorrespondingScreenContentType = null;
            eColor = new XAttribute(XMLElementsAndAttributes.Color, tile.Color.ToString());
            eStyle = new XAttribute(XMLElementsAndAttributes.Style, GenerateStringValue(tile.Style));
            eCoordinate = new XAttribute(XMLElementsAndAttributes.Coordinate, GenerateStringValue(tile.Coordinate));
            eAction = new XAttribute(XMLElementsAndAttributes.Action, tile.Action.ToString());
            eActionURI = new XAttribute(XMLElementsAndAttributes.ActionURI, tile.ActionURI);         

            if (tile.SubTiles != null && tile.SubTiles.Count != 0)
            {
                eSubTiles = GetXElementTiles(tile.SubTiles);
            }
            else
            {
                eSubTiles = null;
            }

            for (int i = 0; i < ((id.Length - id.Replace(XMLElementsAndAttributes.Sub, "").Length) / XMLElementsAndAttributes.Sub.Length); i++)
            {
                appendSub += XMLElementsAndAttributes.Sub;
            }

            return new XElement(appendSub + XMLElementsAndAttributes.Tile, eSubTiles, eId, eName, eTileType, eContent, eCorrespondingScreenContentType, eColor, eStyle, eCoordinate, eAction, eActionURI);
        }
        /// <summary>
        /// Code will receive messages from the floor
        /// Invoke appropriate content projection based on the tile ID passed
        /// </summary>
        /// <param name="val"></param>
        public void OnMessageReceived(string val)
        {
            try
            {
                //Check for reset
                if (val.Equals("Reset"))
                {
                    //Update the previous entry
                    Utilities.TelemetryWriter.UpdatePreviousEntry();

                    //Reset the system
                    ResetUI();
                }
                //Check for System start
                //Check for System start
                else if (val.StartsWith("System Start"))
                {
                    //Load the telemetry Data
                    Utilities.TelemetryWriter.RetrieveTelemetryData();

                    //The floor has asked the screen to start the system
                    //Get the User Name
                    Globals.UserName = val.Split(':')[1];

                    //Get the person identity for the session
                    personName = String.IsNullOrEmpty(Globals.UserName) ? Convert.ToString(Guid.NewGuid()) : Globals.UserName;

                    Utilities.TelemetryWriter.AddTelemetryRow(rippleData.Floor.SetupID, personName, "Unlock", val, "Unlock");

                    //Set the system state
                    Globals.currentAppState = RippleSystemStates.UserDetected;

                    //Play the Intro Content
                    ProjectIntroContent(rippleData.Screen.ScreenContents["IntroVideo"]);
                }
                //Check for gestures
                else if (val.StartsWith("Gesture"))
                {
                    OnGestureInput(val.Split(':')[1]);
                }
                //Check for HTMl messages
                else if (val.StartsWith("HTML"))
                {
                    OnHTMLMessagesReceived(val.Split(':')[1]);
                }
                //Check for options- TODO need to figure out
                else if (val.StartsWith("Option"))
                {
                    //Do nothing
                }
                //Check if a content - tile mapping or in general content tag exists
                else
                {
                    if (rippleData.Screen.ScreenContents.ContainsKey(val) && rippleData.Screen.ScreenContents[val].Type != ContentType.Nothing)
                    {
                        //Set the system state
                        Globals.currentAppState = RippleSystemStates.OptionSelected;

                        ProjectContent(rippleData.Screen.ScreenContents[val]);

                        RippleCommonUtilities.LoggingHelper.LogTrace(1, "In Message Received {0} {1}:{2}", Utilities.TelemetryWriter.telemetryData.Tables[0].Rows.Count, Utilities.TelemetryWriter.telemetryData.Tables[0].Rows[Utilities.TelemetryWriter.telemetryData.Tables[0].Rows.Count - 1].ItemArray[6], DateTime.Now);

                        //Update the end time for the previous
                        Utilities.TelemetryWriter.UpdatePreviousEntry();

                        //Insert the new entry
                        Utilities.TelemetryWriter.AddTelemetryRow(rippleData.Floor.SetupID, personName, ((currentTile = GetFloorTileForID(val))==null)?"Unknown":currentTile.Name, val, (val == "Tile0") ? "Start" : "Option");
                    }
                    else
                    {
                        //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 = ContentType.Nothing;

                        ShowText("No content available for this option, Please try some other tile option", "No Content");
                    }
                }
            }
            catch (Exception ex)
            {
                //Do nothing
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in On message received for Screen {0}", ex.Message);
            }


        }
Example #6
0
        /// <summary>
        /// Gets the tile information from the tileTag.
        /// </summary>
        /// <param name="tileTag"></param>
        /// <returns>RippleDictionary.Tile</returns>
        /// <exception cref="System.ArgumentNullException
        ///     RippleDictionary.TileTypeNotKnownException
        ///     RippleDictionary.InvalidStyleException
        ///     RippleDictionary.InvalidCoordinateException
        ///     RippleDictionary.TypeNotKnownException
        ///     RippleDictionary.ActionNotKnownException" />
        private static Tile GetTile(XElement tileTag)
        {
            Tile tile = null;
            string id, name, tileType, content, color, action, actionURI, style, coordinate, correspondingScreenContentType;
            Dictionary<string, Tile> subTiles = new Dictionary<string, Tile>();

            id = tileTag.Attribute(XMLElementsAndAttributes.Id).Value;
            name = tileTag.Attribute(XMLElementsAndAttributes.Name).Value;
            tileType = tileTag.Attribute(XMLElementsAndAttributes.TileType).Value;
            content = tileTag.Attribute(XMLElementsAndAttributes.Content).Value;
            color = tileTag.Attribute(XMLElementsAndAttributes.Color).Value;
            action = tileTag.Attribute(XMLElementsAndAttributes.Action).Value;
            var actionURIObj = tileTag.Attribute(XMLElementsAndAttributes.ActionURI);
            actionURI = actionURIObj != null ? actionURIObj.Value : null;
            style = tileTag.Attribute(XMLElementsAndAttributes.Style).Value;
            coordinate = tileTag.Attribute(XMLElementsAndAttributes.Coordinate).Value;
            var correspondingScreenContentTypeObj = tileTag.Attribute(XMLElementsAndAttributes.CorrespondingScreenContentType);
            correspondingScreenContentType = correspondingScreenContentTypeObj != null ? correspondingScreenContentTypeObj.Value : null;

            if (tileTag.Elements().Count() != 0)
            {
                subTiles = GetTilesDictionaryFromTag(tileTag);
            }
            else
            {
                subTiles = null;
            }

            tile = new Tile(id, name, GetTileType(tileType), color, GetStyle(style), GetCoordinate(coordinate), GetAction(action), actionURI, content, GetType(correspondingScreenContentType), subTiles);

            return tile;
        }
Example #7
0
        /// <summary>
        /// Gets the Floor tag from the Ripple XML.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns>RippleDictionary.Floor</returns>
        /// <exception cref="System.NullReferenceException
        ///     System.ArgumentNullException
        ///     System.FormatException
        ///     System.OverflowException
        ///     RippleDictionary.UndefinedUnlockException
        ///     RippleDictionary.TileTypeNotKnownException
        ///     RippleDictionary.InvalidStyleException
        ///     RippleDictionary.InvalidCoordinateException
        ///     RippleDictionary.TypeNotKnownException
        ///     RippleDictionary.ActionNotKnownException
        ///     RippleDictionary.UnparseableXMLException" />
        public static Floor GetFloorFromXML(string xml)
        {
            Floor floor = null;

            XDocument xdoc = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml));

            foreach (var xel in xdoc.Root.Elements())
            {
                if (xel.Name == XMLElementsAndAttributes.Floor)
                {
                    Start start = null;
                    Transition transition = null;
                    Tile upperTile = null;
                    Dictionary<string, Tile> tiles = new Dictionary<string, Tile>();
                    double lockingPeriod = 0.0;
                    int systemAutoLockPeriod = 0;
                    String setupID = String.Empty;

                    foreach (var tagContent in xel.Elements())
                    {
                        if (tagContent.Name == XMLElementsAndAttributes.Start)
                        {
                            Animation animation;
                            Unlock unlock;
                            int introVideoWaitPeriod;

                            GetStartContent(tagContent, out animation, out unlock, out introVideoWaitPeriod);

                            start = new Start(animation, unlock, introVideoWaitPeriod);
                        }
                        else if (tagContent.Name == XMLElementsAndAttributes.Transition)
                        {
                            string music = tagContent.Attribute(XMLElementsAndAttributes.Music).Value;
                            string animation = tagContent.Attribute(XMLElementsAndAttributes.Animation).Value;

                            transition = new Transition(music, animation);
                        }
                        else if (tagContent.Name == XMLElementsAndAttributes.Tiles)
                        {
                            tiles = GetTilesDictionaryFromTag(tagContent);
                        }
                        else if (tagContent.Name == XMLElementsAndAttributes.UpperTile)
                        {
                            string id = tagContent.Attribute(XMLElementsAndAttributes.Id).Value;
                            string name = tagContent.Attribute(XMLElementsAndAttributes.Name).Value;
                            string tileType = tagContent.Attribute(XMLElementsAndAttributes.TileType).Value;
                            string content = tagContent.Attribute(XMLElementsAndAttributes.Content).Value;
                            string color = tagContent.Attribute(XMLElementsAndAttributes.Color).Value;
                            string action = tagContent.Attribute(XMLElementsAndAttributes.Action).Value;
                            var actionURIObj = tagContent.Attribute(XMLElementsAndAttributes.ActionURI);
                            string actionURI = actionURIObj != null ? actionURIObj.Value : null;
                            string style = tagContent.Attribute(XMLElementsAndAttributes.Style).Value;
                            string coordinate = tagContent.Attribute(XMLElementsAndAttributes.Coordinate).Value;
                            var correspondingScreenContentTypeObj = tagContent.Attribute(XMLElementsAndAttributes.CorrespondingScreenContentType);
                            string correspondingScreenContentType = correspondingScreenContentTypeObj != null ? correspondingScreenContentTypeObj.Value : null;

                            upperTile = new Tile(id, name, GetTileType(tileType), color, GetStyle(style), GetCoordinate(coordinate), GetAction(action), actionURI, content, GetType(correspondingScreenContentType), null);
                        }
                        else if (tagContent.Name == XMLElementsAndAttributes.LockingPeriod)
	                    {
		                    lockingPeriod = Convert.ToDouble(tagContent.Value);
	                    }
                        else if (tagContent.Name == XMLElementsAndAttributes.SystemAutoLockPeriod)
                        {
                            systemAutoLockPeriod = Convert.ToInt32(tagContent.Value);
                        }
                        else if (tagContent.Name == XMLElementsAndAttributes.SetupID)
                        {
                            setupID = tagContent.Value;
                        }
                    }

                    floor = new Floor(start, transition, tiles, lockingPeriod, systemAutoLockPeriod, setupID, upperTile);
                }
                else
                {
                    continue;
                }
            }

            return floor;
        }