private void TransferButton_Click(object sender, EventArgs e) { var count = InputTextBox.Text.Count(Char.IsDigit); string[] TextToTransfer = new string[count]; OutputTextBox.Clear(); using (StringReader reader = new StringReader(InputTextBox.Text)) { string line; while ((line = reader.ReadLine()) != null) { // Do something with the line line = _defaultPhrase + SpacesPhrase + line; if (!string.IsNullOrWhiteSpace(OutputTextBox.Text)) { OutputTextBox.AppendText("\r\n" + line); } else { OutputTextBox.AppendText(line); } OutputTextBox.ScrollToCaret(); } } }
public void Task_OutputDataRecieved(object sender, DataReceivedEventArgs args) { if (!this.IsDisposed) { this.Invoke(new MethodInvoker(delegate { if (!String.IsNullOrEmpty(args.Data)) { OutputTextBox.AppendText(args.Data + Environment.NewLine); OutputTextBox.ScrollToCaret(); } })); } }
private void AppendText(string text) { if (OutputTextBox.InvokeRequired) { SetTextCallback d = new SetTextCallback(AppendText); OutputTextBox.BeginInvoke(d, new object[] { text }); } else { OutputTextBox.AppendText(text); OutputTextBox.ScrollToCaret(); //Application.DoEvents(); } }
public TextOutputForm(StringCollection strings) { InitializeComponent(); if (strings != null) { foreach (string str in strings) { OutputTextBox.AppendText(str + Environment.NewLine); } OutputTextBox.ScrollToCaret(); } }
public void GenerateFinished(string path) { if (InvokeRequired) { // We're not in the UI thread, so we need to call BeginInvoke BeginInvoke(new StringParameterDelegate(GenerateFinished), new object[] { path }); return; } if (Directory.Exists(path)) { this.AppendNormalMsg("Verify Finished"); this.AppendNormalMsg(""); string errLogPath = Path.Combine(path, this.LogFileName); if (!File.Exists(errLogPath)) { using (StreamWriter sw = File.CreateText(errLogPath)) { } } using (StreamWriter sw = File.AppendText(errLogPath)) { sw.WriteLine("================================================"); sw.WriteLine(DateTime.Now.ToUniversalTime().ToString("u")); foreach (string each in this.ErrorLog) { sw.WriteLine(each); } } foreach (string each in this.ErrorLog) { this.AppendNormalMsg(each); } } // enable button this.GenerateButton.Enabled = true; this._counter = 200; this.AppendNormalMsg(""); OutputTextBox.SelectionStart = OutputTextBox.Text.Length; OutputTextBox.ScrollToCaret(); OutputTextBox.Refresh(); }
public void ClearAll() { if (OutputTextBox.InvokeRequired) { ClearAllCallback d = new ClearAllCallback(ClearAll); OutputTextBox.BeginInvoke(d, new object[] { }); } else { OutputTextBox.Clear(); ErrorsAndWarningsDict.Clear(); OutputTextBox.ScrollToCaret(); LastHighlitedLine = -1; //Application.DoEvents(); } }
private void OutputTextBox_TextChanged(object sender, EventArgs e) { OutputTextBox.SelectionStart = OutputTextBox.Text.Length; OutputTextBox.ScrollToCaret(); }