I have a library which fires events to the main window.
The library fires some events and tells when it has finished through the IsBusy property. I want the graphics to be updated by those event and particularly:
private bool _isBusy;
public bool IsBusy
{
get { return _isBusy; }
set
{
_isBusy = value;
if (value)
imgBusy.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send,
new Action(() => imgBusy.Source = new BitmapImage( new Uri(@"../../Resources/redBall.png", UriKind.Relative))));
else
imgBusy.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Send,
new Action(() => imgBusy.Source = new BitmapImage(new Uri(@"../../Resources/greenBall.png", UriKind.Relative))));
}
}
so what I expect is:
idle --> green
started ---> red
terminated ---> green
while its behaviour is:
1. when launched through backgroundworker:
idle ---> green
started --->green
midway ---> red
terminated --->green.
2. when launched without backgroundworker:
idle,started,midway,terminated --->green
But if I put a breakpoint I see that the code is hit there where the colour of the ball is changed!!
I am new with WPF in winforms there was a Mainform.Update. Is there something similar here?
Thanx for any help Patrick