private void Service_ImageRequest(object sender, Services.ImageRequestEventArgs e) { // This event is raised by our local push-service as result of // the tile msg we've sent to each subscriber. This is the time // to pick the right tile image for the subscriber. if (Visual != null) { RenderImage(Visual, e.ImageStream); } }
private void Service_ImageRequest(object sender, Services.ImageRequestEventArgs e) { ImageFileName = e.Parameter; // This event is raised by our local push-service as result of // the tile msg we've sent to a subscriber. This is the time // to pick the right tile image for the subscriber. string imageFile = Path.Combine("Resources/TileImages/Numbers", e.Parameter); if (File.Exists(imageFile)) { using (var reader = File.OpenRead(imageFile)) { byte[] imageBuffer = new byte[reader.Length]; int bytesRead = reader.Read(imageBuffer, 0, imageBuffer.Length); e.ImageStream.Write(imageBuffer, 0, bytesRead); } } }