private void OnPageLoaded(object sender, RoutedEventArgs e)
 {
     if (!isProcessRunning && !isProcessingAdminCommand)
     {
         EnableCommandLineTextBox(true, CommandLine);
         StdOutputScroller.ChangeView(null, StdOutputScroller.ScrollableHeight, null, true);
     }
 }
        private void RunProcess()
        {
            if (string.IsNullOrWhiteSpace(CommandLine.Text))
            {
                return;
            }

            StdOutputScroller.ChangeView(null, StdOutputScroller.ScrollableHeight, null, true);

            AddToCommandHistory(CommandLine.Text);
            currentCommandLine       = commandLineHistory.Count;
            isProcessingAdminCommand = false;

            Run cmdLineRun = new Run
            {
                Foreground = GraySolidColorBrush,
                FontWeight = FontWeights.Bold,
                Text       = "\n" + WorkingDirectory.Text + " " + CommandLine.Text + "\n"
            };

            var commandLineText = CommandLine.Text.Trim();

            EnableCommandLineTextBox(false);
            CommandLine.Text = string.Empty;
            MainParagraph.Inlines.Add(cmdLineRun);
            totalOutputSize += cmdLineRun.Text.Length;

            if (commandLineText.Equals("cls", StringComparison.CurrentCultureIgnoreCase) ||
                commandLineText.Equals("clear", StringComparison.CurrentCultureIgnoreCase))
            {
                ClearOutput();
            }
            else if (commandLineText.StartsWith("cd ", StringComparison.CurrentCultureIgnoreCase) ||
                     commandLineText.StartsWith("chdir ", StringComparison.CurrentCultureIgnoreCase))
            {
                ShowError(Common.GetLocalizedText("CdNotSupported"));
                EnableCommandLineTextBox(true, WorkingDirectory);
            }
            else if (commandLineText.Equals("exit", StringComparison.CurrentCultureIgnoreCase))
            {
                PageService?.NavigateToHome();
            }
            else if (commandLineText.StartsWith("RunAsAdmin", StringComparison.CurrentCultureIgnoreCase))
            {
                RunAdminCommand(commandLineText);
            }
            else
            {
                LaunchCmdProcess(commandLineText);
            }
        }
Exemplo n.º 3
0
 private void StdOutputText_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     StdOutputScroller.ChangeView(null, StdOutputScroller.ScrollableHeight, null);
 }
Exemplo n.º 4
0
 private void OnPageLoaded(object sender, RoutedEventArgs e)
 {
     EnableCommandLineTextBox(true, CommandLine);
     StdOutputScroller.ChangeView(null, StdOutputScroller.ScrollableHeight, null, true);
 }