Exemplo n.º 1
0
        void SetMainQuestViewBindings(QuestViewModel mainQuestViewModel, DetailQuestView detailQuestView)
        {
            if (mainQuestViewModel is null)
            {
                throw new ArgumentNullException(nameof(mainQuestViewModel));
            }

            if (detailQuestView is null)
            {
                throw new ArgumentNullException(nameof(detailQuestView));
            }

            foreach (var componentViewModel in mainQuestViewModel.QuestComponentViewModels)
            {
                if (componentViewModel.GetType() == typeof(DescriptionComponentViewModel))
                {
                    SetDescriptionComponentBindings(componentViewModel as DescriptionComponentViewModel, detailQuestView);
                }

                else if (componentViewModel.GetType() == typeof(ProgressComponentViewModel))
                {
                    SetProgressComponentBindings(componentViewModel as ProgressComponentViewModel, detailQuestView);
                }
            }
        }
Exemplo n.º 2
0
        void SetProgressComponentBindings(ProgressComponentViewModel progressViewModel, DetailQuestView detailQuestView)
        {
            if (progressViewModel is null)
            {
                throw new ArgumentNullException(nameof(progressViewModel));
            }

            if (detailQuestView is null)
            {
                throw new ArgumentNullException(nameof(detailQuestView));
            }
        }
Exemplo n.º 3
0
        void SetDescriptionComponentBindings(DescriptionComponentViewModel descriptionViewModel, DetailQuestView detailQuestView)
        {
            if (descriptionViewModel is null)
            {
                throw new ArgumentNullException(nameof(descriptionViewModel));
            }

            if (detailQuestView is null)
            {
                throw new ArgumentNullException(nameof(detailQuestView));
            }

            detailQuestView.TitleEntry.IsVisible       = true;
            detailQuestView.DescriptionEntry.IsVisible = true;

            var TitleTextBinding = new Binding
            {
                Source = descriptionViewModel,
                Path   = nameof(descriptionViewModel.Title),
                Mode   = BindingMode.TwoWay
            };

            detailQuestView.TitleEntry.SetBinding(Entry.TextProperty, TitleTextBinding);

            var DescriptionTextBinding = new Binding
            {
                Source = descriptionViewModel,
                Path   = nameof(descriptionViewModel.Description),
                Mode   = BindingMode.TwoWay
            };

            detailQuestView.DescriptionEntry.SetBinding(Entry.TextProperty, DescriptionTextBinding);
        }