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);                
            }
        } 
 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);
     }
 }
        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);
            }
        }
        /// <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);
            }
        }
        public void SetScreenProperties(RippleDictionary.Tile tile)
        {
            try
            {
                if (MainPage.rippleData.Screen.ScreenContents.ContainsKey(tile.Id))
                {
                    //Get the screen data
                    RippleDictionary.ScreenContent screenData = MainPage.rippleData.Screen.ScreenContents[tile.Id];

                    //Set the content type
                    this.CBContentTypeValue.SelectedValue = screenData.Type.ToString();

                    //Set the loop video visibility and value
                    this.LoopVideoValue.SelectedValue = (screenData.LoopVideo == null) ? "False" : (Convert.ToBoolean(screenData.LoopVideo) ? "True" : "False");
                    if (screenData.Type == RippleDictionary.ContentType.Video)
                    {
                        this.LoopVideoLabel.Visibility = System.Windows.Visibility.Visible;
                        this.LoopVideoValue.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        this.LoopVideoLabel.Visibility = System.Windows.Visibility.Collapsed;
                        this.LoopVideoValue.Visibility = System.Windows.Visibility.Collapsed;
                    }

                    //Set the content URI
                    if ((screenData.Type == RippleDictionary.ContentType.PPT || screenData.Type == RippleDictionary.ContentType.Image || screenData.Type == RippleDictionary.ContentType.Video || screenData.Type == RippleDictionary.ContentType.HTML) && screenData.Content.StartsWith(@"\Assets\"))
                        this.ContentValue.Text = Utilities.HelperMethods.TargetAssetsRoot + screenData.Content;
                    else
                        this.ContentValue.Text = screenData.Content;

                    //Set the header text
                    this.HeaderValue.Text = screenData.Header;

                    //Set the browse button visibility
                    if (screenData.Type == RippleDictionary.ContentType.Text || screenData.Type == RippleDictionary.ContentType.HTML || screenData.Type == RippleDictionary.ContentType.Nothing)
                        this.ContentBrowseButton.IsEnabled = false;
                    else
                        this.ContentBrowseButton.IsEnabled = true;

                    //Set the content box properties
                    if (screenData.Type == RippleDictionary.ContentType.HTML || screenData.Type == RippleDictionary.ContentType.Text)
                    {
                        this.ContentValue.IsReadOnlyCaretVisible = false;
                        this.ContentValue.IsReadOnly = false;
                    }
                    else
                    {
                        this.ContentValue.IsReadOnlyCaretVisible = true;
                        this.ContentValue.IsReadOnly = true;
                    }
                }
                else
                {
                    //Just set the defaults
                    this.CBContentTypeValue.SelectedValue = RippleDictionary.ContentType.Nothing.ToString();
                    this.ContentValue.Text = "";
                    this.LoopVideoValue.SelectedValue = "False";
                    this.LoopVideoLabel.Visibility = System.Windows.Visibility.Collapsed;
                    this.LoopVideoValue.Visibility = System.Windows.Visibility.Collapsed;
                    this.HeaderValue.Text = "";
                    this.ContentBrowseButton.IsEnabled = false;
                    this.ContentValue.IsReadOnlyCaretVisible = true;
                    this.ContentValue.IsReadOnly = true;
                }
            }
            catch (Exception ex)
            {
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in SetScreenProperties for Screen Properties: {0}", ex.Message);
            }
        } 
        public void SaveScreenProperties(RippleDictionary.Tile tile)
        {
            try
            {
                //Get the content Type
                RippleDictionary.ContentType ct = (RippleDictionary.ContentType)this.CBContentTypeValue.SelectedIndex;
                RippleDictionary.ScreenContent screenData = new RippleDictionary.ScreenContent(ct, tile.Id, this.HeaderValue.Text, this.ContentValue.Text, (this.LoopVideoValue.SelectedValue.ToString() == "False" ? false : true));
                MainPage.rippleData.Screen.CreateOrUpdateScreenContent(tile.Id, screenData);

                //Once successful update the corresponding screen content type for the floor tile
                Utilities.HelperMethods.GetFloorTileForID(tile.Id).CorrespondingScreenContentType = ct;
            }
            catch (Exception ex)
            {
                RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in SaveScreenProperties for Screen Properties: {0}", ex.Message);
            }
        }