• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Host.Coordinates类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Management.Automation.Host.Coordinates的典型用法代码示例。如果您正苦于以下问题:C# Coordinates类的具体用法?C# Coordinates怎么用?C# Coordinates使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Coordinates类属于System.Management.Automation.Host命名空间,在下文中一共展示了Coordinates类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PowerShellRawUI

        public PowerShellRawUI(PowerShellConsoleModel model)
        {
            _model = model;

            ForegroundColor = ConsoleColor.White;
            BackgroundColor = ConsoleColor.Black;
            CursorPosition = new Coordinates(0, 0);
        }
开发者ID:anurse,项目名称:Coco,代码行数:8,代码来源:PowerShellRawUI.cs


示例2: ScriptingHostRawUserInterface

 public ScriptingHostRawUserInterface(ApplicationSettings settings)
 {
     Output = new OutputBuffer();
     backgroundColor = settings.BackgroundColor;
     foregroundColor = settings.ForegroundColor;
     cursorPosition = new Coordinates(0, 0);
     windowPosition = new Coordinates(0, 0);
     cursorSize = 1;
     bufferSize = new Size(settings.HostWidth, Int32.MaxValue);
     windowSize = bufferSize;
 }
开发者ID:scjunkie,项目名称:Console,代码行数:11,代码来源:ScriptingHostRawUserInterface.cs


示例3: ProgressPane

		internal ProgressPane(ConsoleHostUserInterface ui)
		{
			this.location = new Coordinates(0, 0);
			if (ui != null)
			{
				this.ui = ui;
				this.rawui = ui.RawUI;
				return;
			}
			else
			{
				throw new ArgumentNullException("ui");
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:ProgressPane.cs


示例4: BlankAtCursor

 /// <summary>
 /// Blank out at and move rawui.CursorPosition to <paramref name="cursorPosition"/>
 /// </summary>
 /// <param name="cursorPosition">Position to blank out</param>
 private void BlankAtCursor(Coordinates cursorPosition)
 {
     _rawui.CursorPosition = cursorPosition;
     WriteToConsole(" ", true);
     _rawui.CursorPosition = cursorPosition;
 }
开发者ID:dfinke,项目名称:powershell,代码行数:10,代码来源:ConsoleHostUserInterface.cs


示例5: WritePrintToken

        /// <summary>
        ///
        /// Handle writing print token with proper cursor adjustment for ReadLineSafe
        ///
        /// </summary>
        /// <param name="printToken">
        /// 
        /// token output for each char input. It must be a one-char string
        /// 
        /// </param>
        /// <param name="originalCursorPosition">
        /// 
        /// it is the cursor position where ReadLineSafe begins
        /// 
        /// </param>
        /// <exception cref="HostException">
        /// 
        /// If obtaining information about the buffer failed
        ///    OR
        ///    Win32's SetConsoleCursorPosition failed
        /// 
        /// </exception>

        private void WritePrintToken(
            string printToken,
            ref Coordinates originalCursorPosition)
        {
            Dbg.Assert(!string.IsNullOrEmpty(printToken),
                "Calling WritePrintToken with printToken being null or empty");
            Dbg.Assert(printToken.Length == 1,
                "Calling WritePrintToken with printToken's Length being " + printToken.Length);
            Size consoleBufferSize = _rawui.BufferSize;
            Coordinates currentCursorPosition = _rawui.CursorPosition;

            // if the cursor is currently at the lower right corner, this write will cause the screen buffer to
            // scroll up. So, it is necessary to adjust the original cursor position one row up.
            if (currentCursorPosition.Y >= consoleBufferSize.Height - 1 && // last row
                currentCursorPosition.X >= consoleBufferSize.Width - 1)  // last column
            {
                if (originalCursorPosition.Y > 0)
                {
                    originalCursorPosition.Y--;
                }
            }
            WriteToConsole(printToken, false);
        }
开发者ID:dfinke,项目名称:powershell,代码行数:46,代码来源:ConsoleHostUserInterface.cs


示例6: WriteBackSpace

        /// <summary>
        ///
        /// Handle backspace with proper cursor adjustment for ReadLineSafe
        ///
        /// </summary>
        /// <param name="originalCursorPosition">
        /// 
        /// it is the cursor position where ReadLineSafe begins
        /// 
        /// </param>
        /// <exception cref="HostException">
        /// 
        /// If obtaining information about the buffer failed
        ///    OR
        ///    Win32's SetConsoleCursorPosition failed
        /// 
        /// </exception>

        private void WriteBackSpace(Coordinates originalCursorPosition)
        {
            Coordinates cursorPosition = _rawui.CursorPosition;
            if (cursorPosition == originalCursorPosition)
            {
                // at originalCursorPosition, don't move
                return;
            }

            if (cursorPosition.X == 0)
            {
                if (cursorPosition.Y <= originalCursorPosition.Y)
                {
                    return;
                }
                // BufferSize.Width is 1 larger than cursor position
                cursorPosition.X = _rawui.BufferSize.Width - 1;
                cursorPosition.Y--;
                BlankAtCursor(cursorPosition);
            }
            else if (cursorPosition.X > 0)
            {
                cursorPosition.X--;
                BlankAtCursor(cursorPosition);
            }
            // do nothing if cursorPosition.X is left of screen
        }
开发者ID:dfinke,项目名称:powershell,代码行数:45,代码来源:ConsoleHostUserInterface.cs


示例7: SetBufferContents

		public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
		{
			throw new NotSupportedException(Resources.PSHostRawUserInterfaceSetBufferContentsNotSupported);
		}
开发者ID:nickchal,项目名称:pash,代码行数:4,代码来源:PowwaHostRawUserInterface.cs


示例8: SetBufferContents

 /// <summary>
 /// Copies a given character to a region of the screen buffer based 
 /// on the coordinates of the region. This method is not implemented. 
 /// The call fails with an exception.
 /// </summary>
 /// <param name="origin">The coordnates of the region.</param>
 /// <param name="contents">A BufferCell structure that defines the fill character.</param>
 public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
 {
     throw new NotImplementedException("The SetBufferContents() method is not implemented by MyRawUserInterface.");
 }
开发者ID:dbremner,项目名称:Win81Desktop,代码行数:11,代码来源:MyRawUserInterface.cs


示例9: ScrollBufferContents

        public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
        {
            // TODO: REIMPLEMENT PSHostRawUserInterface.ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
            throw new NotImplementedException("The ScrollBufferContents method is not (yet) implemented!");

            //if (_control.Dispatcher.CheckAccess())
            //{
            //    _control.ScrollBufferContents(source, destination, clip, fill);
            //}
            //else
            //{
            //   _control.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
            //    {
            //        _control.ScrollBufferContents(source, destination, clip, fill);
            //    });
            //}
        }
开发者ID:Jaykul,项目名称:PoshConsole,代码行数:17,代码来源:HostRawUI.cs


示例10: Complete

        /// <summary>
        /// Executes the native command once all of the input has been gathered.
        /// </summary>
        /// <exception cref="PipelineStoppedException">
        /// The pipeline is stopping
        /// </exception>
        /// <exception cref="ApplicationFailedException">
        /// The native command could not be run
        /// </exception>
        internal override void Complete()
        {
            // Indicate whether we need to consider redirecting the output/error of the current native command.
            // Usually a windows program which is the last command in a pipeline can be executed as 'background' -- we don't need to capture its output/error streams.
            bool background;

            // Figure out if we're going to run this process "standalone" i.e. without
            // redirecting anything. This is a bit tricky as we always run redirected so
            // we have to see if the redirection is actually being done at the topmost level or not.

            //Calculate if input and output are redirected.
            bool redirectOutput;
            bool redirectError;
            bool redirectInput;

            CalculateIORedirection(out redirectOutput, out redirectError, out redirectInput);

            // Find out if it's the only command in the pipeline.
            bool soloCommand = this.Command.MyInvocation.PipelineLength == 1;

            // Get the start info for the process. 
            ProcessStartInfo startInfo = GetProcessStartInfo(redirectOutput, redirectError, redirectInput, soloCommand);

            if (this.Command.Context.CurrentPipelineStopping)
            {
                throw new PipelineStoppedException();
            }

            // If a problem occurred in running the program, this exception will
            // be set and should be rethrown at the end of the try/catch block...
            Exception exceptionToRethrow = null;
            Host.Coordinates startPosition = new Host.Coordinates();
            bool scrapeHostOutput = false;

            try
            {
                // If this process is being run standalone, tell the host, which might want
                // to save off the window title or other such state as might be tweaked by 
                // the native process
                if (!redirectOutput)
                {
                    this.Command.Context.EngineHostInterface.NotifyBeginApplication();

                    // Also, store the Raw UI coordinates so that we can scrape the screen after
                    // if we are transcribing.
                    try
                    {
                        if (this.Command.Context.EngineHostInterface.UI.IsTranscribing)
                        {
                            scrapeHostOutput = true;
                            startPosition = this.Command.Context.EngineHostInterface.UI.RawUI.CursorPosition;
                            startPosition.X = 0;
                        }
                    }
                    catch (Host.HostException)
                    {
                        // The host doesn't support scraping via its RawUI interface
                        scrapeHostOutput = false;
                    }
                }

                //Start the process. If stop has been called, throw exception.
                //Note: if StopProcessing is called which this method has the lock,
                //Stop thread will wait for nativeProcess to start.
                //If StopProcessing gets the lock first, then it will set the stopped
                //flag and this method will throw PipelineStoppedException when it gets
                //the lock.
                lock (_sync)
                {
                    if (_stopped)
                    {
                        throw new PipelineStoppedException();
                    }

                    try
                    {
                        _nativeProcess = new Process();
                        _nativeProcess.StartInfo = startInfo;
                        _nativeProcess.Start();
                    }
                    catch (Win32Exception)
                    {
#if CORECLR             // Shell doesn't exist on OneCore, so a file cannot be associated with an executable,
                        // and we cannot run an executable as 'ShellExecute' either.
                        throw;
#else
                        // See if there is a file association for this command. If so
                        // then we'll use that. If there's no file association, then
                        // try shell execute...
                        string executable = FindExecutable(startInfo.FileName);
                        bool notDone = true;
//.........这里部分代码省略.........
开发者ID:40a,项目名称:PowerShell,代码行数:101,代码来源:NativeCommandProcessor.cs


示例11: SetBufferContents

 public abstract void SetBufferContents(Coordinates origin, BufferCell[,] contents);
开发者ID:mauve,项目名称:Pash,代码行数:1,代码来源:PSHostRawUserInterface.cs


示例12: ScrollBufferContents

 /// <summary>
 /// This functionality is not currently implemented. The call fails with an exception.
 /// </summary>
 /// <param name="source">Unused</param>
 /// <param name="destination">Unused</param>
 /// <param name="clip">Unused</param>
 /// <param name="fill">Unused</param>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
开发者ID:dgrapp1,项目名称:WindowsSDK7-Samples,代码行数:11,代码来源:MyRawUserInterface.cs


示例13: SetBufferContents

 /// <summary>
 /// Set buffer contents.
 /// </summary>
 public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
 {
     _serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.SetBufferContents2, new object[] { origin, contents });
 }
开发者ID:40a,项目名称:PowerShell,代码行数:7,代码来源:ServerRemoteHostRawUserInterface.cs


示例14: ScrollBufferContents

 public abstract void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill);
开发者ID:mauve,项目名称:Pash,代码行数:1,代码来源:PSHostRawUserInterface.cs


示例15: ScrollBufferContents

 /// <summary>
 /// Scroll buffer contents.
 /// </summary>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     _serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.ScrollBufferContents, new object[] { source, destination, clip, fill });
 }
开发者ID:40a,项目名称:PowerShell,代码行数:7,代码来源:ServerRemoteHostRawUserInterface.cs


示例16: SetBufferContents

 public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
 {
 }
开发者ID:x-cubed,项目名称:Second-Law,代码行数:3,代码来源:HostUI.cs


示例17: ScrollBufferContents

 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
 }
开发者ID:x-cubed,项目名称:Second-Law,代码行数:3,代码来源:HostUI.cs


示例18: ScrollBufferContents

 /// <summary>
 /// Scrolls the contents of the console buffer.
 /// </summary>
 /// <param name="source">The source rectangle to scroll.</param>
 /// <param name="destination">The destination coordinates by which to scroll.</param>
 /// <param name="clip">The rectangle inside which the scrolling will be clipped.</param>
 /// <param name="fill">The cell with which the buffer will be filled.</param>
 public override void ScrollBufferContents(
     Rectangle source, 
     Coordinates destination, 
     Rectangle clip, 
     BufferCell fill)
 {
     Logger.Write(
         LogLevel.Warning,
         "PSHostRawUserInterface.ScrollBufferContents was called");
 }
开发者ID:sunnyc7,项目名称:PowerShellEditorServices,代码行数:17,代码来源:SessionPSHostRawUserInterface.cs


示例19: SetBufferContents

 /// <summary>
 /// Sets the contents of the buffer at the given coordinate.
 /// </summary>
 /// <param name="origin">The coordinate at which the buffer will be changed.</param>
 /// <param name="contents">The new contents for the buffer at the given coordinate.</param>
 public override void SetBufferContents(
     Coordinates origin, 
     BufferCell[,] contents)
 {
     Logger.Write(
         LogLevel.Warning,
         "PSHostRawUserInterface.SetBufferContents was called");
 }
开发者ID:sunnyc7,项目名称:PowerShellEditorServices,代码行数:13,代码来源:SessionPSHostRawUserInterface.cs


示例20: SetBufferContents

        SetBufferContents(Coordinates origin, BufferCell[,] contents)
        {
            if (_externalRawUI == null)
            {
                ThrowNotInteractive();
            }

            _externalRawUI.SetBufferContents(origin, contents);
        }
开发者ID:40a,项目名称:PowerShell,代码行数:9,代码来源:InternalHostRawUserInterface.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Host.PSHost类代码示例发布时间:2022-05-26
下一篇:
C# Host.BufferCell类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap