/// <summary>
        /// Selects a contribution technology for this contribution.
        /// </summary>
        void SelectContributionTechnology(ContributionTechnologyViewModel vm)
        {
            if (vm.IsSelected)
            {
                selectedTechnologies.Remove(vm);
                vm.IsSelected = false;
                return;
            }

            // Max two allowed. Remove first from the selection if another is added.
            if (selectedTechnologies.Count == 2)
            {
                selectedTechnologies[0].IsSelected = false;
                selectedTechnologies.RemoveAt(0);
            }

            selectedTechnologies.Add(vm);
            vm.IsSelected = true;

            //TODO: Replace by the back navigation version from TinyMvvm 3.0.
            contribution.AdditionalTechnologies = selectedTechnologies.Select(x => x.ContributionTechnology).ToList();

            AnalyticsService.Track("Additional Technology Picked",
                nameof(contribution.AdditionalTechnologies),
                vm.ContributionTechnology.Name);
        }
Beispiel #2
0
        /// <summary>
        /// Selects a contribution area for this contribution.
        /// </summary>
        async Task SelectContributionTechnology(ContributionTechnologyViewModel vm)
        {
            if (vm == null)
            {
                return;
            }

            foreach (var item in GroupedContributionTechnologies)
            {
                foreach (var tech in item)
                {
                    tech.IsSelected = false;
                }
            }

            vm.IsSelected = true;

            //TODO: Replace by the back navigation version.
            contribution.ContributionTechnology.Value = vm.ContributionTechnology;

            AnalyticsService.Track("Contribution Technology Picked",
                                   nameof(contribution.ContributionTechnology),
                                   vm.ContributionTechnology.Name);

            await BackAsync();
        }