I have this delegate:
private delegate void NoArgDelegate(BitmapImage image);
I instantiate the delegate and run it with Dispatcher.Invoke like so:
var fetcher = new NoArgDelegate(InstantiateForm);
Dispatcher.Invoke(fetcher, DispatcherPriority.Normal, imageToPassIn);
I have a private field outside of the scope of any method but inside the scope of my ViewModel, inside InstantiateForm I instantiate the object:
private OmrForm _ormForm;
private void InstantiateForm(BitmapImage image)
{
_ormForm = new OmrForm(image);
}
This is all happening in a method inside my ViewModel which runs on the click event of the button on my WPF form.
I do some work in the constructor to work out what type of image I have passed in and set coordinates appropriately, this about 2 seconds, and I want my UI to be responsive during this time, but it's not. I have tried using BeginInvoke also to no avail.
What is going on here, why isn't my method being run asynchronously?