private void btn_Runserver_Click(object sender, EventArgs e) { AddTab(); StartCMD(); } private void AddTab() { TabPage newTab = new TabPage((string)cbConfig.SelectedItem); RichTextBox rtb = new RichTextBox(); rtb.Dock = DockStyle.Fill; rtb.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; rtb.BorderStyle = System.Windows.Forms.BorderStyle.None; rtb.BackColor = System.Drawing.Color.White; rtb.ReadOnly = true; newTab.Tag = rtb; newTab.Name = (string)cbConfig.SelectedItem; newTab.Controls.Add(rtb); tabControl.Controls.Add(newTab); tabControl.SelectTab(newTab); } private void build_ErrorDataReceived(object sender, DataReceivedEventArgs e) { string strMessage = e.Data; if (tabControl.InvokeRequired) { tabControl.Invoke(new Action(() => { RichTextBox rtb = (RichTextBox)tabControl.SelectedTab.Tag; rtb.AppendText(strMessage + Environment.NewLine); rtb.Select(rtb.Text.Length - 1, 0); rtb.ScrollToCaret(); })); } }
proc.OutputDataReceived += build_ErrorDataReceived; proc.BeginOutputReadLine();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)