Exemple #1
0
        /// <summary>
        /// Reads a key stroke from the keyboard device, blocking until a keystroke is typed.
        /// Either one of ReadKeyOptions.IncludeKeyDown and ReadKeyOptions.IncludeKeyUp or both must be specified.
        /// </summary>
        /// <param name="options">
        /// A bit mask of the options to be used to read the keyboard. Constants defined by
        /// <see cref="T:System.Management.Automation.Host.ReadKeyOptions" />
        /// </param>
        /// <returns>
        /// Key stroke depending on the value of <paramref name="options" />.
        /// </returns>
        /// <exception cref="T:System.ArgumentException">
        /// Neither ReadKeyOptions.IncludeKeyDown nor ReadKeyOptions.IncludeKeyUp is specified.
        /// </exception>
        /// <example>
        ///     <MSH>
        ///         $option = [System.Management.Automation.Host.ReadKeyOptions]"IncludeKeyDown";
        ///         $host.UI.RawUI.ReadKey($option)
        ///     </MSH>
        /// </example>
        /// <seealso cref="T:System.Management.Automation.Host.ReadKeyOptions" />
        /// <seealso cref="M:System.Management.Automation.Host.PSHostRawUserInterface.ReadKey" />
        /// <seealso cref="M:System.Management.Automation.Host.PSHostRawUserInterface.ReadKey(System.Management.Automation.Host.ReadKeyOptions)" />
        /// <seealso cref="M:System.Management.Automation.Host.PSHostRawUserInterface.FlushInputBuffer" />
        /// <seealso cref="P:System.Management.Automation.Host.PSHostRawUserInterface.KeyAvailable" />
        public override KeyInfo ReadKey(ReadKeyOptions options)
        {
            var ch = TermInterface.ReadKey((int)options);

            return(new KeyInfo()
            {
                Character = ch, KeyDown = true
            });
        }
Exemple #2
0
 public override PS.KeyInfo ReadKey(PS.ReadKeyOptions options)
 {
     FarNet.KeyInfo k = Far.Api.UI.ReadKey((FarNet.ReadKeyOptions)options);
     return(new PS.KeyInfo((int)k.VirtualKeyCode, k.Character, (PS.ControlKeyStates)k.ControlKeyState, k.KeyDown));
 }
 public override System.Management.Automation.Host.KeyInfo ReadKey(System.Management.Automation.Host.ReadKeyOptions options)
 {
     // throw new NotImplementedException();
 }