I am working with FEZ cobra, I want to change an image on the bases of data receive interrupt from serial port. When i am changing an image in data receive interrupt it is giving me error, the same image, i can able to change in button click.
I think i have to us dispatcher here but i don’t know how? Can some one guide.
You will need to use the dispatcher for updating images on the screen.
See it as a thread safe method in normal .net.
Icon switching using dispatcher class:
void SetControlIcon(Image control, Bitmap icon)
{
control.Dispatcher.Invoke(new TimeSpan(0, 0, 1), new DispatcherOperationCallback(UpdateImageControl), new ImageToUpdate(control, icon));
}
Image update class:
public class ImageToUpdate
{
public ImageToUpdate(Image ctl, Bitmap img)
{
Control = ctl;
Image = img;
}
public Image Control { get; set; }
public Bitmap Image { get; set; }
}
I want to open a Popup window in serial interrupt. I have made a class without using WPF components. When i am writing below code in Serial interrupt, it gives error as “Invalid Operation”.
clsIncomingCallPopup Clpopup = new clsIncomingCallPopup();
As a work around solution, i have already open a popup class and make it hidden. In serial interrupt, i have assign the property as visible through dispatcher and it works.
I think it can be possible to open a class through dispatcher too but don’t know how? Can some one guide?