Yes, i'm sorry. So, i've a new WPF project, that will show once it starts to stream an IP camera. To do this I use the string that shows me only an image. However, to ensure that it becomes video, I use the thread. Because the string for the video streaming doesn't work. To avoid problems of conflict of access of different threads, use the delegates. I post the code of the delegate and the delegate method:
public delegate void Del(Image images, string url);
public void setImage(Image images,string url)
{
if (images.Dispatcher.CheckAccess())
{
Del ert = new Del(setImage);
images.Dispatcher.Invoke(ert, new object[] { images, url });
BitmapImage img = new BitmapImage();
img.BeginInit();
img.UriSource = new Uri(url);
img.EndInit(); // Getting exception here
images.Source = img;
}
else
{
images.Dispatcher.BeginInvoke(new Del(setImage), DispatcherPriority.Normal,
new object[] { images, url });
}
}
public void StreamImg()
{
while (true)
{
var date = DateTime.Today.Hour;
setImage(image1, @"http://ipaddress/jpg/image.jpg" + "?" + date);
Thread.Sleep(10);
}
}
But i've error in:
images.Dispatcher.Invoke(ert, new object[] { images, url });
the error is
An unhandled exception of type 'System.StackOverflowException' in WindowsBase.dll
I hope I was more clear, I'm sorry but I'm new to the forum