This project has moved. For the latest updates, please go here.

Multiple calls to InitializeVM

Oct 4, 2012 at 8:45 PM

Hello,

I come back here with my "old" problem of VM which are initialized multiple times, when a xap has been downloaded : the first activation of view creates the VM, and the second one searches to recreate the VM... I see during debugging into Jounce that fields managed by MEF (its seems to be that for me!) are not correctly initialized, and in fact Jounce recalls the function because the field is not in the correct value. The next call, the field is correct and Joucne runs correctly.

Il just created a wizard service, based on dialog service of Jeremy's blog, using non-shared VM and views. I choose to have one view per wizard page, all of them sharing only one VM. I created a non shared VM and iterate on the MEF codes for the views to create them in association with the VM, all of that is done with the Router methods. All works correctly.

To temporarly resolve my first problem, I created a personal InitializeVM2 function, managed with a boolean field to prevent more than one call to code in it, all that for all my VM classes.

With tracing enabled, I see that the InitializeVM method of the VM class for the wizard is called one time for each view! is it normal for non shared VM and views?

Thanks for your advice.

Bruno