Search code examples
c#windows-phone-7caliburn.micronavigationservice

Navigate away after PhoneNumberResult


This is specifically a Caliburn.Micro question I think, as it has to do with how CB handles navigation in windows phone 7.

I have a view that has the option of launching a phone number chooser. Once the result comes back I store it and navigate away, only the navigation wont work. I assume this is because the Handle method is working with the task and not my view. I know I can stick a button down the end of the page to navigate after the handle is finished but I would like this to happen once the result comes back.

This is what I am doing.

    public void Handle(TaskCompleted<PhoneNumberResult> message)
    {
        webtext.Recipient = message.Result.PhoneNumber;
        webtext.RecipientDisplayName = message.Result.DisplayName;
        CommitWebtextToStorage();

        events.Unsubscribe(this);
        navigationService.UriFor<ComposeViewModel>();
    }

Which wont work. I also can't call a method inside that as that would be the same as what I am doing. I need to let the handle method exit and then call the navigation service.


Solution

  • Actually, the navigation should look like:

    navigationService.UriFor<ComposeViewModel>().Navigate();
    

    (note the final Navigate method)

    If it was just a typo in the question, I guess the issue could have to do with the timing of application resuming (which occurs when you return back to the application after the chooser task is completed).
    In that case, could you please create an issue for this?