/// <summary> /// Resets the UI to System locked mode. /// </summary> private void ResetUI() { try { Globals.ResetGlobals(); currentVideoURI = String.Empty; currentScreenContent = ContentType.Nothing; loopVideo = false; StartVideoPlayed = false; sessionGuid = String.Empty; //Pick up content based on the "LockScreen" ID ProjectContent(rippleData.Screen.ScreenContents["LockScreen"]); //Commit the telemetry data Utilities.TelemetryWriter.CommitTelemetryAsync(); } catch (Exception ex) { //Do nothing RippleCommonUtilities.LoggingHelper.LogTrace(1, "Went wrong in Reset UI 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); } }
/// <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); } }
/// <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); } }
/// <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); } }