Beispiel #1
0
        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);
                }
            }
        }
        async void PushChallengeDetailsPage(Challenge challenge, bool refresh = false)
        {
            var details = new ChallengeDetailsPage(challenge);

            details.OnAccept = async() =>
            {
                await ViewModel.RefreshLeague();
            };

            details.OnDecline = async() =>
            {
                await ViewModel.RefreshLeague();
            };

            details.OnPostResults = async() =>
            {
                await ViewModel.RefreshLeague();

                rankStrip.Membership = ViewModel.CurrentMembership;
            };

            if (refresh)
            {
                await details.ViewModel.RefreshChallenge();
            }

            await Navigation.PushAsync(details);
        }
Beispiel #3
0
        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);
                }
            }
        }
        async void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var vm = e.SelectedItem as ChallengeViewModel;

            if (vm == null)
            {
                return;
            }

            list.SelectedItem = null;

            if (vm.Challenge == null)
            {
                return;
            }

            var details = new ChallengeDetailsPage(vm.Challenge);
            await Navigation.PushAsync(details);
        }
Beispiel #5
0
		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);
				}
			}
		}