WP7 Chooser + SurviveTombstone

Oct 26, 2010 at 9:35 PM

Hey - I've recently started to look into CM and it looks good.  I've been playing around with the HelloWP7 sample and have a question about a VM's that handle a returning chooser and survive tombstoning.

It appears as though the choosers "Handle" event handler in the VM is called before the PhoneBootstrapper's Resurrect method?

Hence if I update a property in my VM with the result of the chooser, which is also marked with the [SurviveTombstone] attribute, the value I set in the "Handle" handler is over-written when the bootstrapper resurrects the VM.  So in the HelloWP7 code, if the "Handle" method in TabViewModel is changed to the following:

        public void Handle(PhoneNumberResult message)
            this.Text = message.PhoneNumber;  // new line
            MessageBox.Show("The result was " + message.TaskResult, this.DisplayName, MessageBoxButton.OK);

And the Text property already had a value before the chooser was launched then the message.PhoneNumber value I set Text to, is over-written with the prior value during the resurrect phase.  (Hopefully that makes sense?)

Am I missing something or should I be approaching this in a different manner?  Any thoughts appreciated!

Oct 26, 2010 at 11:48 PM

That's probably a bug. I'm not sure when I'll get to look at it...probably not until next week. The logic around that stuff is kind of complicated and dependent on several factors. I'll create an issue to remind me to dig into it.

Oct 28, 2010 at 8:28 AM

Ok no worries thanks for the response.  I may get around to looking into a solution before you do, so if that happens I'll let you know my findings.