示例#1
0
        /// <summary>
        /// Handle a request.
        /// </summary>
        /// <param name="pDisplay">The display which called this function.</param>
        /// <param name="pSurface">The surface which this display is hosted on.</param>
        /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
        /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
        public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
        {
            // Find the new surface.
            var sLoad = dArguments.GetValueOrDefault("load", "");

            if (sLoad == null || sLoad == "")
            {
                Log.Write("Cannot open display.  Missing valid 'load' parameter. e.g. 'http://mysite.com'", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Find the new surface.
            var pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("target", ""));

            if (pTargetSurface == null)
            {
                Log.Write("Cannot open display on target surface.  Missing valid 'target' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Do we want to override if occupied?
            var bOverride = dArguments.GetValueOrDefault("override", false);

            // If a display is already on the target surface.
            if (pTargetSurface.ActiveDisplay != null)
            {
                // Do we close it?
                if (bOverride)
                {
                    Authority.DeleteDisplay(pTargetSurface.ActiveDisplay);
                }

                // Or do we respect it's right to life!
                else
                {
                    Log.Write("Cannot open display on target surface.  Surface is already occupied.", pDisplay.ToString(), Log.Type.DisplayWarning);
                    return(false);
                }
            }

            // Create the new display.
            Authority.ShowDisplay(new Display(sLoad), pTargetSurface);
            return(true);
        }
示例#2
0
        /// <summary>
        /// Handle a request.
        /// </summary>
        /// <param name="pDisplay">The display which called this function.</param>
        /// <param name="pSurface">The surface which this display is hosted on.</param>
        /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
        /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
        public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
        {
            // Find the new surface.
            var pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("target", ""));

            if (pTargetSurface == null)
            {
                Log.Write("Cannot move display to target surface.  Missing valid 'target' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Check the surface this view is on is not our target.
            if (pTargetSurface == pDisplay.ActiveSurface)
            {
                Log.Write("Cannot move display to target surface because it is already there.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // If the new surface is occupied, bail.
            if (pTargetSurface.ActiveDisplay != null)
            {
                Log.Write("Cannot move display to target surface because it already has a display on it.", this.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Do we want to force a reload of everything with the move.
            var bForceReload = dArguments.GetValueOrDefault("force_reload", false);

            // If we want to force a reload.
            if (bForceReload)
            {
                Authority.DeleteDisplay(pDisplay);
                Authority.ShowDisplay(new Display(pDisplay.LoadInstruction, pDisplay.RenderResolution), pTargetSurface);
                return(true);
            }

            // If not.
            else
            {
                // Just detach it from one and move to the other.
                Authority.MoveDisplay(pDisplay, pTargetSurface);
                return(true);
            }
        }
示例#3
0
        /// <summary>
        /// Handle a request.
        /// </summary>
        /// <param name="pDisplay">The display which called this function.</param>
        /// <param name="pSurface">The surface which this display is hosted on.</param>
        /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
        /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
        public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
        {
            // Find the new surface.
            var pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("target", ""));

            if (pTargetSurface == null)
            {
                Log.Write("Cannot close display on target surface.  Missing valid 'target' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Close it, if open.
            if (pTargetSurface.ActiveDisplay != null)
            {
                Authority.DeleteDisplay(pTargetSurface.ActiveDisplay);
                return(true);
            }

            // Return false, nothing to do.
            return(false);
        }
示例#4
0
 /// <summary>
 /// Handle a request.
 /// </summary>
 /// <param name="pDisplay">The display which called this function.</param>
 /// <param name="pSurface">The surface which this display is hosted on.</param>
 /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
 /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
 public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
 {
     Authority.DeleteDisplay(pDisplay);
     return(true);
 }
示例#5
0
        /// <summary>
        /// Handle a request.
        /// </summary>
        /// <param name="pDisplay">The display which called this function.</param>
        /// <param name="pSurface">The surface which this display is hosted on.</param>
        /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
        /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
        public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
        {
            // Find the new surface.
            var pCurrentSurface = Authority.FindSurface(dArguments.GetValueOrDefault("source", ""));

            if (pCurrentSurface == null)
            {
                Log.Write("Cannot move target display to target surface.  Missing valid 'source' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Get the target display.
            var pCurrentDisplay = pCurrentSurface.ActiveDisplay;

            if (pCurrentDisplay == null)
            {
                Log.Write("Cannot move target display to target surface.  Source surface has no display.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Find the new surface.
            var pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("dest", ""));

            if (pTargetSurface == null)
            {
                Log.Write("Cannot move target display to target surface.  Missing valid 'dest' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Check the surface this view is on is not our target.
            if (pTargetSurface == pCurrentSurface)
            {
                Log.Write("Cannot move target display to target surface because it is already there.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // If the new surface is occupied, bail.
            if (pTargetSurface.ActiveDisplay != null)
            {
                Log.Write("Cannot move target display to target surface because it already has a display on it.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Do we want to close the display on the destination?
            var bOverride = dArguments.GetValueOrDefault("override", false);

            // If a display is already on the target surface.
            if (pTargetSurface.ActiveDisplay != null)
            {
                // Do we close it?
                if (bOverride)
                {
                    Authority.DeleteDisplay(pTargetSurface.ActiveDisplay);
                }

                // Or do we respect it's right to life!
                else
                {
                    Log.Write("Cannot move target display to target surface.  Surface is already occupied.", pDisplay.ToString(), Log.Type.DisplayWarning);
                    return(false);
                }
            }

            // Do we want to force a reload of everything with the move.
            var bForceReload = dArguments.GetValueOrDefault("force_reload", false);

            // If we want to force a reload.
            if (bForceReload)
            {
                Authority.DeleteDisplay(pCurrentDisplay);
                Authority.ShowDisplay(new Display(pCurrentDisplay.LoadInstruction, pCurrentDisplay.RenderResolution), pTargetSurface);
                return(true);
            }

            // If not.
            else
            {
                // Just detach it from one and move to the other.
                Authority.MoveDisplay(pCurrentDisplay, pTargetSurface);
                return(true);
            }
        }