async protected virtual void OnIncomingPayload(NotificationPayload payload) { string challengeId; if (payload.Payload.TryGetValue("challengeId", out challengeId)) { try { var vm = new BaseViewModel(); var task = AzureService.Instance.GetChallengeById(challengeId); await vm.RunSafe(task); if (task.IsCompleted && !task.IsFaulted && task.Result != null) { var details = new ChallengeDetailsPage(task.Result); details.AddDoneButton(); await App.Current.MainPage.Navigation.PushModalAsync(details.WithinNavigationPage()); } } catch (Exception e) { InsightsManager.Report(e); Console.WriteLine(e); } } }
internal async Task OnIncomingPayload(NotificationPayload payload) { if (payload == null) { return; } if (App.CurrentAthlete == null) { _shelvedPayload = payload; return; } string challengeId; if (payload.Payload.TryGetValue("challengeId", out challengeId)) { try { var vm = new BaseViewModel(); var task = AzureService.Instance.GetChallengeById(challengeId); await vm.RunSafe(task); var details = new ChallengeDetailsPage(task.Result); details.AddDoneButton(); await App.Current.MainPage.Navigation.PushModalAsync(details.GetNavigationPage()); } catch (Exception e) { Insights.Report(e); Console.WriteLine(e); } } }
internal async Task OnIncomingPayload(NotificationPayload payload) { if(payload == null) return; if(App.CurrentAthlete == null) { _shelvedPayload = payload; return; } string challengeId; if(payload.Payload.TryGetValue("challengeId", out challengeId)) { try { var vm = new BaseViewModel(); var task = AzureService.Instance.GetChallengeById(challengeId); await vm.RunSafe(task); var details = new ChallengeDetailsPage(task.Result); details.AddDoneButton(); await App.Current.MainPage.Navigation.PushModalAsync(details.GetNavigationPage()); } catch(Exception e) { Insights.Report(e); Console.WriteLine(e); } } }