Пример #1
0
        private async void UpdateViewAsync()
        {
            if (ViewModel.GoetiaItem != null && ViewModel.GoetiaItem.Success)
            {
                // Image
                this.Image.Source = ViewModel.GoetiaItem.ImageURL;

                // header
                StackLayoutHeader.Children.Add(LabelHeader);
                StackLayoutHeader.Children.Add(LabelDescription);
                LabelHeader.Text      = ViewModel.GoetiaItem.Name;
                LabelDescription.Text = ViewModel.GoetiaItem.Description;
                StackLayoutHeader.Children.Add(LabelFullDescription);

                // contentStack
                var headerViewSeparatorBottom = new BoxView {
                    BackgroundColor = Color.FromHex(AppTheme.SeparatorColor()).MultiplyAlpha(0.5f), HeightRequest = 10,
                };
                ContentStackLayout.Children.Add(Image);
                ContentStackLayout.Children.Add(StackLayoutHeader);
                ContentStackLayout.Children.Add(headerViewSeparatorBottom);

                // info stackLayout
                var stackLayoutInfo = new StackLayout {
                    BackgroundColor = Color.FromHex("#400000"),
                    Spacing         = 0,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
                foreach (GoetiaDetailInformationViewModel informationVM in ViewModel.ListViewModels)
                {
                    stackLayoutInfo.Children.Add(new HorizontalLabelDetailContentView(informationVM.Title, informationVM.Info));
                }
                ContentStackLayout.Children.Add(stackLayoutInfo);
            }
            else
            {
                // network error
                var popupPage = new LabelButtonPopupPage("Error", "Something went wrong, please try again later.", "Close", 100)
                {
                    PageDelegate = this
                };
                await Navigation.PushPopupAsync(popupPage);
            }
            CustomActivityIndicator.IsRunning = false;
        }