Esempio n. 1
0
        /// <summary> 运行Cmd命令 </summary>
        public Bitmap GetPrintScreen()
        {
            using (ChannelFactory <IStreamPrivider> channelFactory = new ChannelFactory <IStreamPrivider>(WSHttpBinding, ImageSenderAddress))
            {
                IStreamPrivider proxy = channelFactory.CreateChannel();

                MemoryStream writeStream = new MemoryStream();

                proxy.PrintStreenToStream();

                byte[] buffer;

                //获取所用块压缩流,并组装
                while (proxy.ReadNextBuffer())
                {
                    // read bytes from input stream
                    buffer = proxy.GetCurrectBuffer();

                    // write bytes to output stream
                    writeStream.Write(buffer, 0, buffer.Length);
                }

                Bitmap bitmap = new Bitmap(writeStream);

                writeStream.Dispose();

                return(bitmap);
            }
        }
Esempio n. 2
0
 public bool ReadNextBuffer()
 {
     return(_streamprivider.ReadNextBuffer());
 }