I have a MVVVM app with a view model that uses Hammock .
I call my Get2
function in the code behind my main page like this:
private void List2_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if (List2.SelectedItem != null)
{
((MainPageViewModel)DataContext).Get2();
NavigationService.Navigate(new Uri("/Page3.xaml", UriKind.Relative));
}
}
Here is my Get2
Function:
public void Get2()
{
[...]
restClient.BeginRequest(restRequest, Get2CallBack);
}
private void GetListStatusesCallBack(RestRequest Request, RestResponse Response, object Obj)
{
[...]
}
But what happens at the end of my Get2()
function is that instead of reaching the callback function just after , it goes back to my MainPage code behind, executs the NavigationService.Navigate(new Uri("/Page3.xaml", UriKind.Relative));
, quits the List2_SelectionChanged_1
and then reaches the CallBack function finally .
How come my CallBack Function is not reached just after Get2() ?
I would like the CallBack to be reached before the Navigation Event,