12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
-
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.Data;
- using System.Text;
- using System.Windows.Forms;
- namespace OpenSim.GridLaunch.GUI.WinForm
- {
- public partial class ucInputField : UserControl
- {
- public delegate void LineEnteredDelegate(string Text);
- public event LineEnteredDelegate LineEntered;
- public List<string> History = new List<string>();
- public ucInputField()
- {
- InitializeComponent();
- }
- private void ucInputField_Load(object sender, EventArgs e)
- {
- _resize();
- }
- private void ucInputField_Resize(object sender, EventArgs e)
- {
- _resize();
- }
- private void _resize()
- {
- Height = txtInput.Height + 10;
- }
- private void btnSend_Click(object sender, EventArgs e)
- {
- Send();
- }
- private void txtInput_KeyPress(object sender, KeyPressEventArgs e)
- {
-
- if (e.KeyChar == 13)
- {
- e.Handled = true;
- Send();
- }
-
- }
- private void Send()
- {
-
- string txt = txtInput.Text.TrimEnd("\r\n".ToCharArray());
-
- if (LineEntered != null)
- LineEntered(txt);
-
- History.Add(txtInput.Text);
- txtInput.Text = "";
- }
- }
- }
|