if (msg.eventType == EventType.Data)
{
using MemoryStream stream = new MemoryStream(msg.data);
Dispatcher.Invoke(() =>
{
pictureBox.Source = BitmapFrame.Create(stream,
BitmapCreateOptions.None,
BitmapCacheOption.OnLoad);
});
}