public void Output(string str) { OutText.Text += str + "\r\n"; OutText.Select(OutText.TextLength, 0); OutText.ScrollToCaret(); OutText.Invalidate(); }
private void CodeEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e) { if (_completionWindow != null) { return; } IList <MyCompletionData> tipData = null; var lead = GetLeading(); // 这里得到 a.b.c bool hasDot = false; if (lead.Contains(".")) { hasDot = true; lead = lead.Split('.').Last(); //这里得到 c } if (lead.Length > 0) { OutText.AppendText("请求提示:" + lead + Environment.NewLine); OutText.ScrollToEnd(); } if (e.Text == ".") { if (0 == _tips["animals"].Where(p => p.Text == lead).Count()) { return; } tipData = _tips["actions"]; } else if (e.Text == "(") { //TODO 函数提示 return; } else if (char.IsLetterOrDigit(e.Text[0]) && !hasDot) { if (0 == _tips["animals"].Where(p => p.Text.StartsWith(lead, StringComparison.CurrentCultureIgnoreCase)).Count()) { return; } tipData = _tips["animals"]; } if (tipData == null) { return; } _completionWindow = new CompletionWindow(CodeEditor.TextArea); _completionWindow.ResizeMode = ResizeMode.NoResize; var data = _completionWindow.CompletionList.CompletionData; foreach (var item in tipData) { data.Add(item); } _completionWindow.Show(); _completionWindow.Closed += delegate { _completionWindow = null; }; }
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(); }
/// <summary> /// Here the output to the file names are Generated. Every file name will be put into a new line. /// #serial# serial numbers as prefix. /// #name# filename /// #date# current date only without slashes (/) /// #bigdate# current date spelled withoutslashes /// #time# current time only without colons (:) /// </summary> /// <returns></returns> internal string OutputText(string filename, int serial = 0) { if (OutText.Empty()) { return($@"{filename}{Environment.NewLine}"); } string _str = OutText; string[] _notation = new string[] { "#serial#", "#name#", "#date#", "#bigdate#", "#time#" }; if (_str.IndexOf("#name#") < 0) { _str += $" {filename}"; } foreach (var not in _notation) { string value = ""; switch (not) { case "#serial#": value = ""; break; case "#name#": value = filename; break; case "#date#": value = DateTime.Today.ToString("MMddyyyy"); break; case "#bigdate#": value = DateTime.Today.ToString("ddddMMMddyyyy"); break; case "#time#": value = DateTime.Now.ToString("hhmmss"); break; } _str = _str.Replace(not, value); } return(_str + Environment.NewLine); }
private void clearMenu_Click(object sender, EventArgs e) { OutText.Clear(); }