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 SnapperWindow(int x, int y, int width, int height) : base("Snap N 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; // Create the MultiSession object so we can send stuff out to a group //fSession = new MultiSession(Guid.NewGuid().ToString(), ipep); fSession = new MultiSession(ipep, Guid.NewGuid().ToString(), "William", true, true, null); // Add the channel for graphics commands PayloadChannel payloadChannel = fSession.CreateChannel(PayloadType.dynamicPresentation); fCommandDispatcher = new GraphPortChunkEncoder(payloadChannel); fUserIOChannel = fSession.CreateChannel(PayloadType.xApplication2); //fUserIOEncoder = new UserIOChannelEncoder(fUserIOChannel); //fUserIODecoder = new UserIOChannelDecoder(fUserIOChannel); //fUserIODecoder.MouseActivityEvent += new MouseActivityEventHandler(fUserIODecoder_MouseActivityEvent); //fUserIODecoder.KeyboardActivityEvent += new KeyboardActivityEventHandler(fUserIODecoder_KeyboardActivityEvent); // 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(); }