當前位置: 首頁>>代碼示例>>C#>>正文


C# Host.Coordinates類代碼示例

本文整理匯總了C#中System.Management.Automation.Host.Coordinates的典型用法代碼示例。如果您正苦於以下問題:C# Coordinates類的具體用法?C# Coordinates怎麽用?C# Coordinates使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Coordinates類屬於System.Management.Automation.Host命名空間,在下文中一共展示了Coordinates類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的System.Management.Automation.Host.Coordinates類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。