当前位置: 首页>>代码示例>>C#>>正文


C# Display.ToString方法代码示例

本文整理汇总了C#中Display.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Display.ToString方法的具体用法?C# Display.ToString怎么用?C# Display.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Display的用法示例。


在下文中一共展示了Display.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessRequest

        /// <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;
            }
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:32,代码来源:PlaySound.cs

示例2: ProcessRequest

        /// <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;
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:40,代码来源:SwapDisplay.cs

示例3: ProcessRequest

 /// <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;
     }
 }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:22,代码来源:LowestPointCube.cs

示例4: ProcessRequest

        /// <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;
            }
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:50,代码来源:MoveDisplay.cs

示例5: ProcessRequest

        /// <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;
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:49,代码来源:OpenDisplay.cs

示例6: ProcessRequest

        /// <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;
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:47,代码来源:SwapTargetDisplay.cs

示例7: ProcessRequest

 /// <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;
     }
 }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:20,代码来源:LockPC.cs

示例8: ProcessRequest

        /// <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;
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:27,代码来源:CloseTargetDisplay.cs

示例9: SetDisplay

        //-------------------------------------------------------------------------------------------------//
        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;
        }
开发者ID:gumpyoung,项目名称:ilabproject-code,代码行数:55,代码来源:ST360Counter.cs

示例10: ProcessRequest

        /// <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;
            }
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:86,代码来源:MoveTargetDisplay.cs


注:本文中的Display.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。