private void Initialize()
        {
            Logger Log = Logger.Instance;

            Console.SetOut(Log);
            DataContext = Log.Content;
            Loaded     += new RoutedEventHandler(delegate(object sender, RoutedEventArgs e)
            {
                InputBlock.KeyDown += new KeyEventHandler(delegate(object _sender, KeyEventArgs _e)
                {
                    if (_e.Key == Key.Enter)
                    {
                        Log.RunCommand(InputBlock.Text);
                        InputBlock.Text = "";
                        InputBlock.Focus();
                    }
                });
                Log.Updated += new Logger.UpdatedEventHandler(delegate(string value)
                {
                    Scroller.ScrollToBottom();
                    if (Log.Content.Output.Count > 500)
                    {
                        Log.Content.Output.RemoveAt(0);
                    }
                });
            });
        }
        private void InputBlock_OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            string input = InputBlock.Text;

            switch (e.Key)
            {
            case Key.Enter:
                e.Handled = true;
                _model.ExecuteCommand(input);
                break;

            case Key.Tab:
                e.Handled = true;
                _model.ShowMatchingCommand(input);
                InputBlock.SelectionStart  = InputBlock.Text.Length;
                InputBlock.SelectionLength = 0;
                break;

            case Key.Up:
                e.Handled = true;
                _model.GoToPreviousCommand();
                break;

            case Key.Down:
                e.Handled = true;
                _model.GoToNextCommand();
                break;
            }

            InputBlock.Focus();
            Keyboard.Focus(InputBlock);
            Scroller.ScrollToBottom();
        }
示例#3
0
 void WriteLine(string Text, params string[] args)
 {
     Console.ConsoleInput = string.Format(Text, args);
     Console.RunCommand();
     InputBlock.Focus();
     Scroller.ScrollToBottom();
 }
        async void InputBlock_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (cmdexecListener.isSubscribed)
                {
                    return;
                }

                string cmd = InputBlock.Text;
                await _wxhtpClient.ExecuteTask(
                    _ct, _wxhtpClient.getTcpClient().Client.RemoteEndPoint.ToString(), METHOD_TYPE.GET, ACTION_TYPE.COMMAND_PROMPT, cmd);

                cmdexecListener.Subscribe(_wxhtpClient, dc);

                dc.ConsoleInput = InputBlock.Text;
                dc.RunCommand();
                InputBlock.IsReadOnly = true;
                InputBlock.Focus();
                Task r = Task.Delay(TimeSpan.FromSeconds(1.5));
                r.Wait();
                InputBlock.IsReadOnly = false;
                Scroller.ScrollToBottom();
            }
        }
示例#5
0
 void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         dc.ConsoleInput = InputBlock.Text;
         dc.RunCommand();
         InputBlock.Focus();
         Scroller.ScrollToBottom();
     }
 }
示例#6
0
 private void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     Console.WriteLine("key " + e.Key.ToString());
     if (e.Key == Key.Enter)
     {
         dc.ConsoleInput = InputBlock.Text;
         dc.RunCommand();
         InputBlock.Focus();
         Scroller.ScrollToBottom();
     }
 }
        async void InputBlock_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                _minecraftConsole.ConsoleInput = InputBlock.Text;
                await _minecraft.SendCommandAsync(_minecraftConsole.ConsoleInput);

                _minecraftConsole.RunCommand();
                InputBlock.Focus();
                MinecraftConsole.ScrollToBottom();
            }
        }
示例#8
0
        public ConsoleView()
        {
            InitializeComponent();

            this.DataContext = dc;

            InputBlock.KeyDown += InputBlock_KeyDown;
            InputBlock.Focus();

            Scroller.KeyDown += Scroller_KeyDown;

            dc.Enter = (input) => { };
        }
        void KeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                Repl.ConsoleInput = InputBlock.Text;
                if (InputBlock.Text == "")
                {
                    return;
                }

                Repl.RunCommand();
                InputBlock.Focus();
                Scroller.ScrollToBottom();
            }
        }
示例#10
0
 async void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         InputBlock.IsEnabled = false;
         try
         {
             await _context.ConsoleVM.RunCommand();
         }
         finally
         {
             InputBlock.IsEnabled = true;
             InputBlock.Focus();
             Scroller.ScrollToBottom();
         }
     }
 }
 private void ConsoleTerminal_OnLoaded(object sender, RoutedEventArgs e)
 {
     InputBlock.Focus();
 }
示例#12
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlock_KeyDown;
     InputBlock.Focus();
 }
 private void OutputView_OnMouseEnter(object sender, MouseEventArgs e)
 {
     InputBlock.Focus();
 }
 public void SetFocus()
 {
     InputBlock.Focus();
 }
示例#15
0
 private void windowLoaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlockKeyDown;
     InputBlock.Focus();
 }
示例#16
0
 public void showOutput()
 {
     dc.RunCommand();
     InputBlock.Focus();
     Scroller.ScrollToBottom();
 }
示例#17
0
 void Console_Loaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlock_KeyDown;
     InputBlock.Focus();
 }
示例#18
0
 internal void IssueInputBlock()
 {
     dc.ConsoleInput = InputBlock.Text;
     dc.RunConsoleInput();
     InputBlock.Focus();
 }
 private void ConsoleTerminal_OnMouseUp(object sender, MouseButtonEventArgs e)
 {
     InputBlock.Focus();
 }
 void LoadedHandler(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyUp += KeyDownHandler;
     InputBlock.Focus();
 }
示例#21
0
 private void Scroller_KeyDown(object sender, KeyEventArgs e)
 {
     InputBlock.Focus();
 }
示例#22
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     Console.WriteLine("MAIN WINDOW LOADED");
     InputBlock.KeyDown += InputBlock_KeyDown;
     InputBlock.Focus();
 }