protected void SendPicture(Image image, string name, int index) { string message = "Sending picture " + name; Invoke(new MethodInvokerString(SetStatusBar), new Object[] { message }); PicturePackage[] packages = PicturePackager.GetPicturePackages(name, index, image, 1024); // Send all segments of a single picture to the group foreach (PicturePackage package in packages) { byte[] data = encoding.GetBytes(package.GetXml()); int sendBytes = udpClient.Send(data, data.Length, groupEP); if (sendBytes < 0) { MessageBox.Show("Error in sending"); } Thread.Sleep(300); } message = "Picture " + name + " sent"; Invoke(new MethodInvokerString(SetStatusBar), new Object[] { message }); }
private void DisplayPicture(int id) { PicturePackage[] packages = (PicturePackage[])pictureArray[id]; Image picture = PicturePackager.GetPicture(packages); pictureArray.Remove(id); pictureBox.Image = picture; }