Esempio n. 1
0
        public Form1()
            : base("Snap N Viewer", 20, 20, 640, 480)
        {
            fAutoScale = true;

            // Create the backing buffer to retain the image
            fBackingBuffer = new GDIDIBSection(1600, 1200);

            // 1.  Show a dialog box to allow the user to type in the 
            // group IP address and port number.
            HostForm groupForm = new HostForm();
            //groupForm.ShowDialog();

            // 2. Get the address and port from the form, and use
            // them to setup the MultiSession object
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            Title = "Snap N Viewer - " + ipep.ToString();

            fCommChannel = new CommChannel(ipep, false, true);

            // 3. Setup the chunk decoder so we can receive new images
            // when they come in
            fChunkDecoder = new GraphPortChunkDecoder(fBackingBuffer, fCommChannel);
            fChunkDecoder.PixBltPixelBuffer24Handler += this.PixBltPixelBuffer24;
            fChunkDecoder.PixBltLumbHandler += this.PixBltLum24;
        }
        public GraphPortChunkDecoder(GDIDIBSection pixMap, CommChannel channel)
        {
            fGrayImage = new PixelArray<Lumb>(pixMap.Width, pixMap.Height);
            fChannel = channel;
            fChannel.ReceivedFrameEvent += FrameReceived;

            fPixMap = pixMap;
        }
Esempio n. 3
0
        public SnapperWindow(int x, int y, int width, int height)
            : base("Pixel Share", 10, 10, 640, 480)
        {
            // Show a form so we can capture the desired group IP and port number
            ServerForm groupForm = new ServerForm();
            //IPAddress randomAddress = NewTOAPIA.Net.Utility.GetRandomMulticastAddress();
            //groupForm.groupAddressField.Text = randomAddress.ToString();
            groupForm.ShowDialog();

            // Get the address and port from the form
            fUseGray = groupForm.checkBox1.Checked;
            string groupIP = groupForm.groupAddressField.Text;
            int groupPort = int.Parse(groupForm.groupPortField.Text);
            IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(groupIP), groupPort);

            // Set our title to the address specified so the user
            // can easily identify their session.
            Title = "SnapNShare - " + ipep.ToString();
            
            fSnapper = new ScreenSnapper();

            fClientOrigin = new POINT();
            int pwidth = ClientRectangle.Width;
            int pheight = ClientRectangle.Height;
            fScreenImage = new GDIDIBSection(width, height, BitCount.Bits24);
            fGrayImage = new PixelArray<Lumb>(width, height,fScreenImage.Orientation, new Lumb());

            BackgroundColor = RGBColor.White;
            this.Opacity = 0.5;


            // Add the channel for graphics commands
            CommChannel graphicsChannel = new CommChannel(ipep, true, false);
            fCommandDispatcher = new GraphPortChunkEncoder(graphicsChannel);

            // Start the thread that will take snapshots of the screen
            fGlobalTimer = new PrecisionTimer();
            fFrameRate = 2; // Frames per second
            fSnapperRunning = true;
            snapperThread = new Thread(RunSnaps);
            snapperThread.Start();
        }
 public GraphPortChunkEncoder(CommChannel aChannel)
 {
     fCollaborationChannel = aChannel;
 }