/**压缩函数*/ private void bitmapZipToBlockingQueue() { while (isSendPic) { try { manulResetEvent.WaitOne(); } catch (ThreadInterruptedException ex) { manulResetEvent.Reset(); Console.WriteLine(ex.Message); ErrorInfo.getErrorWriter().writeErrorMassageToFile(ex.Message); return; } while (picFlag) { DifferentBitmapWithCursor differentBitmapWithCursor = screenCopyDifQueue.Dequeue(); if (differentBitmapWithCursor != null) { // Console.WriteLine("compressThread***********"); try { SendPacket sendPacket = new SendPacket(); sendPacket.setPacketType(SendPacket.PacketType.BITMAP); sendPacket.setBitmapType(differentBitmapWithCursor.getBitmapType()); sendPacket.setCursorPoint(differentBitmapWithCursor.getCursorPoint()); sendPacket.setDifPointsList(differentBitmapWithCursor.getDifPointsList()); byte[] bmpBytes = JpegZip.jpegAndZip(differentBitmapWithCursor.getDifBitmap(), isMove); sendPacket.setBitByts(bmpBytes); sendPacket.setBitmapBytesLength(bmpBytes.Length); sendPacketQueue.Enqueue(sendPacket); textBoxSDQ.Text = sendPacketQueue.getQueueSize() + ""; } catch (Exception ex) { Console.WriteLine(ex.Message); ErrorInfo.getErrorWriter().writeErrorMassageToFile(ex.Message); return; } } } } }
private void sendMessage2Client(String message) { SendPacket sendpacket = new SendPacket(); sendpacket.setPacketType(SendPacket.PacketType.TEXT); sendpacket.setStringValue(message); sendPacketQueue.Enqueue(sendpacket); textBoxSDQ.Text = sendPacketQueue.getQueueSize() + ""; }