コード例 #1
0
        public ConsoleControl()
        {
            _commandBox = new RichTextBox
            {
                IsEnabled     = true,
                Focusable     = true,
                AcceptsTab    = true,
                AcceptsReturn = true,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                Padding    = new Thickness(0),
                Margin     = new Thickness(0),
                Background = Brushes.BurlyWood
            };
            _popup      = new PopupMenu(this);
            _expansion  = new TabExpansion();
            _cmdHistory = new CommandHistory();

            // Add the popup to the logical branch of the console so keystrokes can be
            // processed from the popup by the console for the tab-complete scenario.
            // E.G.: $Host.Pri[tab].  => "$Host.PrivateData." instead of swallowing the period.
            AddLogicalChild(_popup);

            // _commandBox.Document.TextAlignment = TextAlignment.Left;
            _passwordBox = new PasswordBox
            {
                IsEnabled = true,
                Focusable = true
            };
            _commandBox.PreviewKeyDown  += _commandBox_PreviewKeyDown;
            _passwordBox.PreviewKeyDown += _passwordBox_PreviewKeyDown;

            _commandContainer = new InlineUIContainer(_commandBox)
            {
                BaselineAlignment = BaselineAlignment.Top
            };                                                                                                    //.TextTop

            //ScrollViewer.SizeChanged += new SizeChangedEventHandler(ScrollViewer_SizeChanged);

            this.Dispatcher.ShutdownStarted += (sender, args) =>
            {
                Dispose();
            };
        }
コード例 #2
0
ファイル: ConsoleControl.cs プロジェクト: Jaykul/PoshConsole
        public ConsoleControl()
        {
            _commandBox = new RichTextBox
            {
                IsEnabled = true,
                Focusable = true,
                AcceptsTab = true,
                AcceptsReturn = true,
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                Padding = new Thickness(0),
                Margin = new Thickness(0),
                Background = Brushes.BurlyWood
            };
            _popup = new PopupMenu(this);
            _expansion = new TabExpansion();
            _cmdHistory = new CommandHistory();

            // Add the popup to the logical branch of the console so keystrokes can be
            // processed from the popup by the console for the tab-complete scenario.
            // E.G.: $Host.Pri[tab].  => "$Host.PrivateData." instead of swallowing the period.
            AddLogicalChild(_popup);

            // _commandBox.Document.TextAlignment = TextAlignment.Left;
            _passwordBox = new PasswordBox
            {
                                  IsEnabled = true,
                                  Focusable = true
                              };
            _commandBox.PreviewKeyDown += _commandBox_PreviewKeyDown;
            _passwordBox.PreviewKeyDown += _passwordBox_PreviewKeyDown;

            _commandContainer = new InlineUIContainer(_commandBox) { BaselineAlignment = BaselineAlignment.Top }; //.TextTop

            //ScrollViewer.SizeChanged += new SizeChangedEventHandler(ScrollViewer_SizeChanged);

            this.Dispatcher.ShutdownStarted += (sender, args) =>
            {
                Dispose();
            };
        }