コード例 #1
0
        public async Task AddQuestionToSavedProfile(Question newQuestion)
        {
            MaybeResult <PlayerProfile, GenericErrorResult> getProfileResult = await GetProfile(newQuestion.PlayerId);

            if (getProfileResult.IsError)
            {
                Debug.WriteLine($"Couldn't fine a profile with ID {newQuestion.PlayerId}");
                return;
            }

            PlayerProfile profile = getProfileResult.Unwrap();

            profile.Questions.Add(newQuestion);
            await SaveProfile(profile);

            _messagingService.Send(new ProfileUpdated {
                NewQuestion = newQuestion
            });
        }
コード例 #2
0
        public async Task SelectProfile(Guid id)
        {
            MaybeResult <PlayerProfile, GenericErrorResult> profileSelectionResult = await _profileService.GetProfile(id);

            if (profileSelectionResult.IsError)
            {
                throw new ArgumentNullException("id", $"Unable to find a profile with the id {id} on the local device.");
            }

            // Navigate to profile overview page that shows all questions
            await _navigationService.NavigateToViewModelAsync <ProfileOverviewViewModel>(profileSelectionResult.Unwrap());
        }