Hello all,
i have the following problem, im requesting data from my Rest service and in the ViewModel it shows everything perfekt. But when i execute the command from my ContentPage it has no data in, its allways null. I want to fill a Picker with data. The following code is from my ViewModel.
ViewModel:
public Command StartCommand {
get { return startCommand ?? (startCommand = new Command (async () => await ExecuteStartCommand ())); }
}
public async Task GetFirstLoginDetails ()
{
if (IsBusy) {
return;
}
IsBusy = true;
try {
if (ConnectivityService.IsConnected ()) {
LoginService service = new LoginService ();
LoginModel loginModel = await service.GetLoginDetails ();
} else {
DialogService.ShowError ("No Internet Connection");
}
} catch (Exception ex) {
Debug.WriteLine (ex);
}
IsBusy = false;
}
This ist the Code of my ContentPage. I Simply execute my Command on OnAppearing(). But Unfortunately i get null back.
protected override void OnAppearing ()
{
base.OnAppearing ();
ViewModel.UserDetailsCommand.Execute (null);
}