ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #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 pTargetSurface = Authority.FindSurface(dArguments.GetValueOrDefault("target", ""));
            if (pTargetSurface == null)
            {
                Log.Write("Cannot swap 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 swap display to target surface because it is already there.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }

            // If the target surface has a display, get a reference and remove it.
            Display pOtherView = pTargetSurface.ActiveDisplay;
            if (pOtherView != null)
                Authority.RemoveDisplay(pOtherView);

            // Remove this display from this surface and put it on the target surface.
            Authority.RemoveDisplay(pDisplay);
            Authority.ShowDisplay(pDisplay, pTargetSurface);

            // Now put the other display on the original surface.
            if (pOtherView != null)
                Authority.ShowDisplay(pOtherView, pSurface);

            // Boom.
            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)
        {
            // Check we have a sound file.
            var sSound = dArguments.GetValueOrDefault("file", "");

            if (sSound == null || sSound == "")
            {
                Log.Write("Cannot play sound.  Are you missing a 'file' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Attempt to play it.
            try
            {
                SoundPlayer pSound = new SoundPlayer(sSound);
                pSound.Play();
                return(true);
            }

            // Log warnings.
            catch (Exception e)
            {
                Log.Write("Cannot play sound. " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }
        }
Пример #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)
        {
            // Check we have a sound file.
            var sSound = dArguments.GetValueOrDefault("file", "");
            if (sSound == null || sSound == "")
            {
                Log.Write("Cannot play sound.  Are you missing a 'file' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }

            // Attempt to play it.
            try
            {
                SoundPlayer pSound = new SoundPlayer(sSound);
                pSound.Play();
                return true;
            }
            
            // Log warnings.
            catch (Exception e)
            {
                Log.Write("Cannot play sound. " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }
        }
Пример #4
0
 public void CommandParser_Scenario_1()
 {
     Assert.AreEqual(
         "###...." + Environment.NewLine +
         "###...." + Environment.NewLine +
         "......." + Environment.NewLine,
         display.ToString());
 }
        //-------------------------------------------------------------------------------------------------//

        public bool SetDisplay(Display selection)
        {
            const string STRLOG_MethodName = "SetDisplay";

            string logMessage = STRLOG_Selection + selection.ToString();

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            bool success = true;

            try
            {
                while (true)
                {
                    //
                    // Get the current display selection
                    //
                    byte[] readData = WriteReadData(new byte[] { CMD_ReadDisplaySelection }, 1, DATALEN_CMD_Read);
                    if (readData == null || readData.Length != DATALEN_CMD_Read || readData[0] != CMD_ReadDisplaySelection)
                    {
                        throw new Exception(STRERR_FailedToSetDisplaySelection + selection.ToString());
                    }
                    Display currentSelection = (Display)readData[DATALEN_CMD_Read - 1];

                    //
                    // Check if this is the desired selection
                    //
                    if (currentSelection == selection)
                    {
                        break;
                    }

                    //
                    // Move the display selection down by one
                    //
                    readData = WriteReadData(new byte[] { CMD_PushDisplaySelectSwitch }, 1, DATALEN_CMD_Push);
                    if (readData == null || readData.Length != DATALEN_CMD_Push || readData[0] != CMD_PushDisplaySelectSwitch)
                    {
                        throw new Exception(STRERR_FailedToPushDisplaySelectSwitch);
                    }
                }
            }
            catch (Exception ex)
            {
                success        = false;
                this.lastError = ex.Message;
            }

            logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return(success);
        }
Пример #6
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)
        {
            // Get the first target.
            var pTarget1 = Authority.FindSurface(dArguments.GetValueOrDefault("target1", ""));

            if (pTarget1 == null)
            {
                Log.Write("SwapTargetDisplay: Missing valid 'target1' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Get the first target.
            var pTarget2 = Authority.FindSurface(dArguments.GetValueOrDefault("target2", ""));

            if (pTarget2 == null)
            {
                Log.Write("SwapTargetDisplay: Missing valid 'target2' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Check the surface this view is on is not our target.
            if (pTarget1 == pTarget2)
            {
                Log.Write("SwapTargetDisplay: Surface targets are the same.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Store references to the displays.
            Display pDisplay1 = pTarget1.ActiveDisplay;
            Display pDisplay2 = pTarget2.ActiveDisplay;

            // Remove them both from surfaces.
            if (pDisplay1 != null)
            {
                Authority.RemoveDisplay(pDisplay1);
            }
            if (pDisplay2 != null)
            {
                Authority.RemoveDisplay(pDisplay2);
            }

            // Re-open them on the other surfaces.
            if (pDisplay1 != null)
            {
                Authority.ShowDisplay(pDisplay1, pTarget2);
            }
            if (pDisplay2 != null)
            {
                Authority.ShowDisplay(pDisplay2, pTarget1);
            }

            // Boom.
            return(true);
        }
Пример #7
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)
 {
     try
     {
         var pResource = new LowestPointCube(pDisplay, dArguments);
         pDisplay.AttachResource(pResource);
         Log.Write("LowestPointCube created relative to '" + pResource.RelativeSurface.Identifier + "'.", pDisplay.ToString(), Log.Type.DisplayInfo); 
         return true;
     }
     catch (Exception e)
     {
         Log.Write("Error creating LowestPointCube: " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning);
         return false;
     }
 }
Пример #8
0
        public override void Write(CustomFileWriter writer)
        {
            writer.WriteLine($"{Type.ToString().ToLowerInvariant()} (");
            using (writer.Indent())
            {
                writer.WriteLine($"{("env." + Name).DoubleQuote()},");
                writer.WriteLine($"label = {Name.DoubleQuote()},");

                if (Description != null)
                {
                    writer.WriteLine($"description = {Description.DoubleQuote()},");
                }

                writer.WriteLine($"value = {DefaultValue.DoubleQuote()},");

                if (AllowMultiple)
                {
                    writer.WriteLine("allowMultiple = true,");
                    writer.WriteLine($"valueSeparator = {ValueSeparator.DoubleQuote()},");
                }

                if (Options != null)
                {
                    var mappings = Options.Select(x => $"{x.Key.DoubleQuote()} to {x.Value.ToString().DoubleQuote()}");
                    writer.WriteLine($"options = listOf({mappings.JoinComma()}),");
                }

                if (Options == null)
                {
                    writer.WriteLine($"allowEmpty = {(Display != TeamCityParameterDisplay.Prompt).ToString().ToLowerInvariant()},");
                }

                writer.WriteLine($"display = ParameterDisplay.{Display.ToString().ToUpperInvariant()})");
            }
        }
Пример #9
0
        protected override void OnPreRender(EventArgs e)
        {
            switch (this.Display)
            {
            case eDisplayOption.This_Week:
                SetWeekDays();
                break;

            case eDisplayOption.This_Month:
                SetMonthDays();
                break;

            case eDisplayOption.This_Year:
                StartDate = new DateTime(DateTime.Today.Year, 01, 01, 00, 00, 00);
                EndDate   = new DateTime(DateTime.Today.Year, 12, 31, 23, 59, 59);
                break;

            case eDisplayOption.Last_30_Days:
                SetLast30Days();
                break;
            }

            this.DataUrl = string.Format(
                "{0}/api/order/statisticsbystate?dateFrom={1:s}&dateTo={2:s}&orderStateIDs={3}",
                ConfigurationManager.AppSettings["ApiBaseUrl"],
                StartDate,
                EndDate,
                this.GetOrderStateIDs());

            this.Title = "Orders By State For " + Display.ToString().Replace("_", " ");
        }
        public async Task <IActionResult> Reverse(
            [FromHeader(Name = "X-CallingAppId")] string callingAppId,
            [FromHeader(Name = "X-CallingAppName")] string callingAppName,
            [FromHeader(Name = "X-CallingAppVersion")] string callingAppVersion,
            [FromHeader(Name = "X-CallingAppKey")] string callingAppKey,
            [FromQuery] string coords,
            [FromQuery] string key      = null,
            [FromQuery] string lang     = null,
            [FromQuery] Display?display = null,
            [FromQuery] Format?format   = null)
        {
            var url = new Url(W3WAPIURLBASE)
                      .AppendPathSegment("v2/reverse")
                      .SetQueryParams(new
            {
                coords,
                key = key ?? _w3wApiKey,
                lang,
                display = display?.ToString().ToLower(),
                format  = format?.ToString().ToLower()
            });

            var responseMessage = await _w3wHttpClient.GetAsync(url).ConfigureAwait(false);

            var result = Content(await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false),
                                 responseMessage.Content.Headers.ContentType.MediaType);

            return(result);
        }
Пример #11
0
 public void Dump()
 {
     foreach (Shape Display in Components)
     {
         Console.WriteLine(Display.ToString());
     }
 }
Пример #12
0
        public void DisplayTest()
        {
            var screen = new VirtualScreen(99,
                                           new Rectangle(9999, 9999, 9999, 9999),
                                           "Awesome Screen",
                                           false,
                                           new Rectangle(8888, 8888, 8888, 888));

            var screenNumber = 12;

            var d = new Display(screen, screenNumber);


            // Null Checks
            Assert.IsNotNull(d.Above);
            Assert.IsNotNull(d.Below);
            Assert.IsNotNull(d.ToLeft);
            Assert.IsNotNull(d.ToRight);
            Assert.IsNotNull(d.ToString());
            Assert.IsNotNull(d.DetailledDescription());

            // Screen Stuff
            Assert.AreEqual(screenNumber, d.ScreenNumber);
            Assert.AreSame(screen, d.Screen);
            Assert.AreEqual(screen.Bounds, d.Bounds);

            Console.WriteLine(d.DetailledDescription());
        }
Пример #13
0
 public override string ToString()
 {
     if (Display == null)
     {
         return(string.Empty);
     }
     return(Display.ToString());
 }
Пример #14
0
 public void GetInformationDevice()
 {
     Console.WriteLine(
         $"Display: {display.ToString()}\n" +
         $"CPU: {cpu.ToString()}\n" +
         $"RAM: {ram.ToString()}\n" +
         $"ROM: {rom.ToString()}\n"
         );
 }
Пример #15
0
            protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver)
            {
                if (!string.IsNullOrEmpty(Position))
                {
                    attributes[HtmlTextWriterStyle.Position] = Position;
                }
                if (!string.IsNullOrEmpty(Visibility))
                {
                    attributes[HtmlTextWriterStyle.Visibility] = Visibility;
                }
                if (!Left.IsEmpty)
                {
                    attributes[HtmlTextWriterStyle.Left] = Left.ToString();
                }
                if (!Top.IsEmpty)
                {
                    attributes[HtmlTextWriterStyle.Top] = Top.ToString();
                }

                if (!string.IsNullOrEmpty(Margin))
                {
                    attributes[HtmlTextWriterStyle.Margin] = Margin.ToString();
                }
                if (!string.IsNullOrEmpty(Padding))
                {
                    attributes[HtmlTextWriterStyle.Padding] = Padding.ToString();
                }
                if (!string.IsNullOrEmpty(ListStyle))
                {
                    attributes["list-style"] = ListStyle.ToString();
                }
                if (!string.IsNullOrEmpty(Float))
                {
                    attributes["float"] = Float.ToString();
                }
                if (!string.IsNullOrEmpty(Display))
                {
                    attributes[HtmlTextWriterStyle.Display] = Display.ToString();
                }
                if (!string.IsNullOrEmpty(Cursor))
                {
                    attributes[HtmlTextWriterStyle.Cursor] = Cursor.ToString();
                }



                base.FillStyleAttributes(attributes, urlResolver);

                string[] filter = new string[] { "left", "right", "top", "bottom", "width", "height", "margin-left", "margin-right", "margin-top", "margin-bottom" };
                foreach (string f in filter)
                {
                    if (!string.IsNullOrEmpty(attributes[f]))
                    {
                        attributes[f] = attributes[f].Replace(",", ".");
                    }
                }
            }
Пример #16
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;
            }
        }
Пример #17
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;
        }
Пример #18
0
 public void GetInformationDevice()
 {
     Console.WriteLine(
         $"Keyboard: {keyboard.ToString()}\n" +
         $"Display: {display.ToString()}\n" +
         $"TouchPad: {touchPad.ToString()}\n" +
         $"CPU: {cpu.ToString()}\n" +
         $"RAM: {ram.ToString()}\n" +
         $"ROM: {rom.ToString()}"
         );
 }
Пример #19
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting managed/unmanaged resources.
 /// </summary>
 /// <param name="disposing">
 ///
 /// A <see cref="System.Boolean"/> indicating whether the disposition is requested explictly.
 /// </param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if ((_OwnDisplay == true) && (Display != IntPtr.Zero))
         {
             Glx.UnsafeNativeMethods.XCloseDisplay(Display);
             KhronosApi.LogFunction("XCloseDisplay({0})", Display.ToString("X"));
         }
     }
 }
Пример #20
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)
        {
            // Get the first target.
            var pTarget1 = Authority.FindSurface(dArguments.GetValueOrDefault("target1", ""));
            if (pTarget1 == null)
            {
                Log.Write("SwapTargetDisplay: Missing valid 'target1' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }

            // Get the first target.
            var pTarget2 = Authority.FindSurface(dArguments.GetValueOrDefault("target2", ""));
            if (pTarget2 == null)
            {
                Log.Write("SwapTargetDisplay: Missing valid 'target2' parameter.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }

            // Check the surface this view is on is not our target.
            if (pTarget1 == pTarget2)
            {
                Log.Write("SwapTargetDisplay: Surface targets are the same.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return false;
            }

            // Store references to the displays.
            Display pDisplay1 = pTarget1.ActiveDisplay;
            Display pDisplay2 = pTarget2.ActiveDisplay;

            // Remove them both from surfaces.
            if (pDisplay1 != null) Authority.RemoveDisplay(pDisplay1);
            if (pDisplay2 != null) Authority.RemoveDisplay(pDisplay2);

            // Re-open them on the other surfaces.
            if (pDisplay1 != null) Authority.ShowDisplay(pDisplay1, pTarget2);
            if (pDisplay2 != null) Authority.ShowDisplay(pDisplay2, pTarget1);

            // Boom.
            return true;
        }
Пример #21
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)
 {
     try
     {
         LockWorkStation();
         return true;
     }
     catch
     {
         Log.Write("Error locking workstation.", pDisplay.ToString(), Log.Type.DisplayWarning);
         return false;
     }
 }
Пример #22
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)
 {
     try
     {
         LockWorkStation();
         return(true);
     }
     catch
     {
         Log.Write("Error locking workstation.", pDisplay.ToString(), Log.Type.DisplayWarning);
         return(false);
     }
 }
Пример #23
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)
 {
     try
     {
         var pResource = new LowestPointCube(pDisplay, dArguments);
         pDisplay.AttachResource(pResource);
         Log.Write("LowestPointCube created relative to '" + pResource.RelativeSurface.Identifier + "'.", pDisplay.ToString(), Log.Type.DisplayInfo);
         return(true);
     }
     catch (Exception e)
     {
         Log.Write("Error creating LowestPointCube: " + e.Message, pDisplay.ToString(), Log.Type.DisplayWarning);
         return(false);
     }
 }
Пример #24
0
            public override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebControl owner)
            {
                if (!string.IsNullOrEmpty(Position))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Position, Position);
                }
                if (!string.IsNullOrEmpty(Visibility))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Visibility, Visibility);
                }
                if (!Left.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Left, Left.ToString());
                }
                if (!Top.IsEmpty)
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Top, Top.ToString());
                }

                if (!string.IsNullOrEmpty(Margin))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, Margin.ToString());
                }
                if (!string.IsNullOrEmpty(Padding))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, Padding.ToString());
                }
                if (!string.IsNullOrEmpty(ListStyle))
                {
                    writer.AddStyleAttribute("list-style", ListStyle.ToString());
                }
                if (!string.IsNullOrEmpty(Float))
                {
                    writer.AddStyleAttribute("float", Float.ToString());
                }

                if (!string.IsNullOrEmpty(Display))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Display, Display.ToString());
                }

                if (!string.IsNullOrEmpty(Cursor))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, Cursor.ToString());
                }

                base.AddAttributesToRender(writer, owner);
            }
Пример #25
0
        }//jError()

        /// <summary>
        /// </summary>
        public static JObject jError(CswNbtResources CswNbtResources, Exception ex)
        {
            JObject          Ret = new JObject();
            string           Message, Detail;
            CswEnumErrorType Type;
            bool             Display;

            error(CswNbtResources, ex, out Type, out Message, out Detail, out Display);

            Ret["success"]          = "false";
            Ret["error"]            = new JObject();
            Ret["error"]["display"] = Display.ToString().ToLower();
            Ret["error"]["type"]    = Type.ToString();
            Ret["error"]["message"] = Message;
            Ret["error"]["detail"]  = Detail;
            return(Ret);
        }//jError()
Пример #26
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;
        }
Пример #27
0
 public static String ToCSSText(Display display)
 {
     return(display.ToString().Replace('_', '-'));
 }
Пример #28
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 swap 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 swap display to target surface because it is already there.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // If the target surface has a display, get a reference and remove it.
            Display pOtherView = pTargetSurface.ActiveDisplay;

            if (pOtherView != null)
            {
                Authority.RemoveDisplay(pOtherView);
            }

            // Remove this display from this surface and put it on the target surface.
            Authority.RemoveDisplay(pDisplay);
            Authority.ShowDisplay(pDisplay, pTargetSurface);

            // Now put the other display on the original surface.
            if (pOtherView != null)
            {
                Authority.ShowDisplay(pOtherView, pSurface);
            }

            // Boom.
            return(true);
        }
Пример #29
0
        //-------------------------------------------------------------------------------------------------//
        public bool SetDisplay(Display selection)
        {
            const string STRLOG_MethodName = "SetDisplay";

            string logMessage = STRLOG_Selection + selection.ToString();

            Logfile.WriteCalled(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            bool success = true;

            try
            {
                while (true)
                {
                    //
                    // Get the current display selection
                    //
                    byte[] readData = WriteReadData(new byte[] { CMD_ReadDisplaySelection }, 1, DATALEN_CMD_Read);
                    if (readData == null || readData.Length != DATALEN_CMD_Read || readData[0] != CMD_ReadDisplaySelection)
                    {
                        throw new Exception(STRERR_FailedToSetDisplaySelection + selection.ToString());
                    }
                    Display currentSelection = (Display)readData[DATALEN_CMD_Read - 1];

                    //
                    // Check if this is the desired selection
                    //
                    if (currentSelection == selection)
                    {
                        break;
                    }

                    //
                    // Move the display selection down by one
                    //
                    readData = WriteReadData(new byte[] { CMD_PushDisplaySelectSwitch }, 1, DATALEN_CMD_Push);
                    if (readData == null || readData.Length != DATALEN_CMD_Push || readData[0] != CMD_PushDisplaySelectSwitch)
                    {
                        throw new Exception(STRERR_FailedToPushDisplaySelectSwitch);
                    }
                }
            }
            catch (Exception ex)
            {
                success = false;
                this.lastError = ex.Message;
            }

            logMessage = STRLOG_Success + success.ToString();

            Logfile.WriteCompleted(STRLOG_ClassName, STRLOG_MethodName, logMessage);

            return success;
        }
Пример #30
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);
            }
        }
Пример #31
0
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            /* if we're rendering uplevel, add our attributes */
            if (render_uplevel)
            {
                /* force an ID here if we weren't assigned one */
                if (ID == null)
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID);
                }

                if (ControlToValidate != String.Empty)
                {
                    RegisterExpandoAttribute(ClientID, "controltovalidate", GetControlRenderID(ControlToValidate));
                }

                if (ErrorMessage != String.Empty)
                {
                    RegisterExpandoAttribute(ClientID, "errormessage", ErrorMessage, true);
                }

                if (ValidationGroup != String.Empty)
                {
                    RegisterExpandoAttribute(ClientID, "validationGroup", ValidationGroup, true);
                }

                if (SetFocusOnError)
                {
                    RegisterExpandoAttribute(ClientID, "focusOnError", "t");
                }

                bool enabled = IsEnabled;
                if (!enabled)
                {
                    RegisterExpandoAttribute(ClientID, "enabled", "False");
                }

                if (enabled && !IsValid)
                {
                    RegisterExpandoAttribute(ClientID, "isvalid", "False");
                }
                else
                {
                    if (Display == ValidatorDisplay.Static)
                    {
                        writer.AddStyleAttribute("visibility", "hidden");
                    }
                    else
                    {
                        writer.AddStyleAttribute("display", "none");
                    }
                }

                if (Display != ValidatorDisplay.Static)
                {
                    RegisterExpandoAttribute(ClientID, "display", Display.ToString());
                }
            }

            base.AddAttributesToRender(writer);
        }
Пример #32
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);
        }
Пример #33
0
 public override string ToString()
 {
     return("\n" + "GSM Model:" + model + "\nManifacturer:" + manifacturer + "\nPrice:" + price + "\nOwner:" + owner + display.ToString() + battery.ToString());
 }
Пример #34
0
        public List <AssemblerContent> GetAssemblerInv()
        {
            List <AssemblerContent> assemblerContents = new List <AssemblerContent>();

            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + SteelPlate.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + ConstructionComponent.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + InteriorPlate.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + SmallTube.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + MotorComponent.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + ComputerComponent.ToString().Split('/')[1], amount = 0
            });
            assemblerContents.Add(new AssemblerContent()
            {
                componentName = "" + Display.ToString().Split('/')[1], amount = 0
            });


            foreach (var assembler in Assemblers)
            {
                // Output inventory
                List <MyInventoryItem> iTmp = new List <MyInventoryItem>();
                assembler.GetInventory(1).GetItems(iTmp);

                foreach (var item in iTmp)
                {
                    string name = item.Type.ToString().Split('/')[1];
                    var    ac   = assemblerContents.Where(y => y.componentName.Equals(name)).FirstOrDefault();

                    if (ac != null)
                    {
                        ac.amount += item.Amount.ToIntSafe();
                    }
                    else
                    {
                        Message = "Unusuable component in assembler inventory. \nComponent: " + name;
                    }
                }

                // Production Queue
                List <MyProductionItem> qTmp = new List <MyProductionItem>();
                assembler.GetQueue(qTmp);

                foreach (var item in qTmp)
                {
                    string name = item.BlueprintId.ToString().Split('/')[1];
                    var    ac   = assemblerContents.Where(y => y.componentName.Equals(name)).FirstOrDefault();

                    if (ac != null)
                    {
                        ac.amount += item.Amount.ToIntSafe();
                    }
                    else
                    {
                        Message = "Unusuable component in assembler queue. \nComponent: " + name;
                    }
                }
            }

            return(assemblerContents);
        }
Пример #35
0
 public override string ToString()
 {
     return(Display.ToString());
 }
Пример #36
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;
            }
        }
Пример #37
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);
            }
        }
Пример #38
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);
        }
Пример #39
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)
        {
            // Get the callback.
            var sCallback = dArguments.GetValueOrDefault("callback", "");

            if (sCallback == null || sCallback == "")
            {
                Log.Write("Please specify a 'callback' value.", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Get the list of surface names we want to find information for.
            var lSurfaces = dArguments.GetValueOrDefault("surfaces", new JSValue[] { });

            if (lSurfaces == null || lSurfaces.Length == 0)
            {
                Log.Write("Please specify a 'surfaces' value. i.e. ['Surface 0', 'Surface 1']", pDisplay.ToString(), Log.Type.DisplayWarning);
                return(false);
            }

            // Create an object to store the information about each surface.
            JSObject dOut = new JSObject();

            foreach (var jsSurf in lSurfaces)
            {
                // If it is a string, find the surface.
                var sSurfName = (jsSurf.IsString) ? (String)jsSurf : null;
                if (sSurfName == null)
                {
                    continue;
                }

                // Find the surface.
                var pSurf = Authority.FindSurface(sSurfName);
                if (pSurf == null)
                {
                    continue;
                }

                // Otherwise, get the information about it.
                var jsSurfObj = new JSObject();
                dOut[pSurf.Identifier] = jsSurfObj;

                // Surface properties.
                jsSurfObj["Name"]        = new JSValue(pSurf.Identifier);
                jsSurfObj["Width"]       = new JSValue(pSurf.Width);
                jsSurfObj["Height"]      = new JSValue(pSurf.Height);
                jsSurfObj["AspectRatio"] = new JSValue(pSurf.AspectRatio);
                jsSurfObj["Angle"]       = new JSValue(pSurf.Angle);

                // Add world coordinates.
                var pWorld = new JSObject();
                pWorld["topleft"]     = JSExtensions.MakeCoordinate(pSurf.SensorSpace[Surface.TOPLEFT_INDEX]);
                pWorld["topright"]    = JSExtensions.MakeCoordinate(pSurf.SensorSpace[Surface.TOPRIGHT_INDEX]);
                pWorld["bottomleft"]  = JSExtensions.MakeCoordinate(pSurf.SensorSpace[Surface.BOTTOMLEFT_INDEX]);
                pWorld["bottomright"] = JSExtensions.MakeCoordinate(pSurf.SensorSpace[Surface.BOTTOMRIGHT_INDEX]);
                pWorld["normal"]      = JSExtensions.MakeCoordinate(pSurf.Plane.Normal);
                jsSurfObj["World"]    = pWorld;

                // Add kinect coordinates.
                var pKinect = new JSObject();
                pKinect["topleft"]     = JSExtensions.MakeCoordinate(pSurf.KinectSpace[Surface.TOPLEFT_INDEX]);
                pKinect["topright"]    = JSExtensions.MakeCoordinate(pSurf.KinectSpace[Surface.TOPRIGHT_INDEX]);
                pKinect["bottomleft"]  = JSExtensions.MakeCoordinate(pSurf.KinectSpace[Surface.BOTTOMLEFT_INDEX]);
                pKinect["bottomright"] = JSExtensions.MakeCoordinate(pSurf.KinectSpace[Surface.BOTTOMRIGHT_INDEX]);
                pKinect["width"]       = 320;
                pKinect["height"]      = 240;
                jsSurfObj["Kinect"]    = pKinect;
            }

            // Dispatch it back on the callback.
            pDisplay.AsyncCallGlobalFunction(sCallback, dOut);
            return(true);
        }