Exemple #1
0
        public void AppendText(String data)
        {
            TabPageRTBox.AppendText(data);
            TabPageRTBox.Select(0, TabPageRTBox.Text.Length);
            TabPageRTBox.SelectionProtected = true;

            last_pos = TabPageRTBox.Text.Length;
            TabPageRTBox.SelectionStart = last_pos;
            TabPageRTBox.Focus();
        }
Exemple #2
0
        private async void TabPageRTBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                temp_str = TabPageRTBox.Text.Substring(last_pos).Trim();
                Console.WriteLine($"Command TabPageRTBox_KeyDown is {temp_str}");
                // write to the Stream from begining every time.
                // Write the length first as int (4 bytes)
                //mstream.Position = 0;
                byte[] cmd_bytes = Encoding.Unicode.GetBytes(temp_str);

                byte[] cmd_len     = BitConverter.GetBytes(cmd_bytes.Length);
                int    cmd_len_int = cmd_bytes.Length;
                int    len_of_int  = cmd_len.Length; // usually four bytes on 64 bit systems, sizeof int

                /*
                 * mstream.Write(cmd_len, 0, len_of_int);
                 * int count = 0;
                 * while (count < cmd_len_int)
                 * {
                 *  mstream.WriteByte(cmd_bytes[count++]);
                 * }
                 */
                //mstream.WriteAsync(temp_str);
                await tabProc.WriteToProcessAsync(temp_str + "\n");

                Console.WriteLine($"Written to stream........{temp_str}");

                Console.WriteLine("Readming from stream........");
                string outstr = await tabProc.ReadFromProcessAsync();

                Console.WriteLine($"Line........:{outstr}");
                outstr = await tabProc.ReadFromProcessAsync();

                Console.WriteLine($"Line........:{outstr}");

                this.AppendText("\n");

                TabPageRTBox.DeselectAll();
            }
            else
            {
            }

            /*
             * else
             * {
             *  if(e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.Capital)
             *  {
             *      shift_pressed = true;
             *  }
             *  else
             *  {
             *      int kval = e.KeyValue;
             *      if (!shift_pressed)
             *      {
             *          kval += 32;
             *      }
             *      temp_str += (char)kval;
             *  }
             *
             * }
             */
        }
Exemple #3
0
 void CutAction(object sender, EventArgs e)
 {
     TabPageRTBox.Cut();
 }