Пример #1
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            try
            {
                var tcp = new TcpManager(IpTextBox.Text, PortTextBox.Text);
                var buf = tcp.Send("ps");

                var buf2   = buf.Where(n => n != 0).ToArray();
                var resMsg = Encoding.UTF8.GetString(buf2, 0, buf2.Length);
                this.Msg.Text = resMsg;
            }
            catch (Exception ex)
            {
                this.Msg.Text = ex.Message;
            }
        }
Пример #2
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                var tcp = new TcpManager(IpTextBox.Text, PortTextBox.Text);
                var buf = tcp.Send("cap");

                Console.WriteLine("GetData");

                var ms  = new MemoryStream(buf);
                var bmp = new Bitmap(ms);
                var w   = new CapForm {
                    pictureBox1 = { Height = bmp.Height, Width = bmp.Width, Image = bmp }
                };
                w.Show();
            }
            catch (Exception ex)
            {
                this.Msg.Text = ex.Message;
            }
        }