public void Output(string str) { OutText.Text += str + "\r\n"; OutText.Select(OutText.TextLength, 0); OutText.ScrollToCaret(); OutText.Invalidate(); }
public void UpdateChatWindow(String message) { if (OutText.InvokeRequired) { Invoke(_updateChatWindowDelgate, message); } else { OutText.Text += message + "\n"; OutText.SelectionStart = OutText.Text.Length; OutText.ScrollToCaret(); } }
private void ExecuteButton_Click(object sender, EventArgs e) { StartAnimation(); try { Process process = new Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = process.StartInfo.RedirectStandardError = true; process.StartInfo.FileName = _Program; process.StartInfo.Arguments = GetCommand(); process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; process.StartInfo.CreateNoWindow = true; process.Start(); string output = process.StandardOutput.ReadToEnd(); string error = process.StandardError.ReadToEnd(); OutText.Text += Environment.NewLine; if (output != Environment.NewLine) { OutText.Text += output; } if (!string.IsNullOrEmpty(error)) { OutText.Text += error; } process.WaitForExit(); } catch (Exception ex) { OutText.Text += ex.ToString(); } OutText.SelectionStart = OutText.Text.Length; OutText.ScrollToCaret(); StopAnimation(); }