protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); var endpointId = Query(PageParams.ENDPOINT); var alarmId = Query(PageParams.ID); var isDoNothing = endpointId == null && alarmId == null; var isAddNew = endpointId != null && alarmId == null; var isUpdate = alarmId != null; if (isDoNothing) { } else { // After updating the time (on a separate page), the user is // navigated back here, then the alarm is loaded from the backend // and the old time is reinstated. Clearing the navigation query // string fixes this. The alarm is then only loaded when clicked // from the Alarms page. MusicEndpoint endpoint = DetermineEndpointOrActive(PageParams.ENDPOINT); NavigationContext.QueryString.Clear(); viewModel = AlarmModel.Build(endpoint, timeHelper); DataContext = viewModel; if (isUpdate) { await viewModel.Fill(alarmId); } await viewModel.InstallPlayer(); //await viewModel.LoadTracks(); } }