public Grid GenerateMainGrid(FullTrail trail) { var gridContainer = new Grid { RowDefinitions = { new RowDefinition { Height = 50 }, new RowDefinition { Height = new GridLength(1, GridUnitType.Auto)} }, }; var mainLabel = GenerateHeader(); gridContainer.Children.Add(mainLabel, 0, 0); gridContainer.Children.Add(GenerateMainScrollTrailPage(trail), 0, 1); return gridContainer; }
private Grid GenerateTableForStaticOptions(FullTrail trail) { var table = new Grid { RowDefinitions = { new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, } }; table.Children.Add(GenerateLabelForTableColumn(nameof(trail.Difficult)), 0, 0); table.Children.Add(GenerateDifficultLabel(trail.Difficult), 1, 0); table.Children.Add(GenerateLabelForTableColumn(nameof(trail.Rate)), 0, 1); table.Children.Add(GenerateLabelForTableValue(trail.Rate.ToString("N1")), 1, 1); table.Children.Add(GenerateLabelForTableColumn(nameof(trail.Region)), 2, 0); table.Children.Add(GenerateLabelForTableValue(trail.Region), 3, 0); table.Children.Add(GenerateLabelForTableColumn(nameof(trail.Country)), 2, 1); table.Children.Add(GenerateLabelForTableValue(trail.Country), 3, 1); return table; }
private Grid GenerateTableForOptions(FullTrail trail) { var table = new Grid { RowDefinitions = { new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 }, new RowDefinition { Height = 50 } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, }; table.Children.Add(GenerateLabelForTableColumn("Distance"), 0, 0); table.Children.Add(GenerateLabelForTableValue(trail.Distance.ToString()), 1, 0); table.Children.Add(GenerateLabelForTableColumn("Peak"), 0, 1); table.Children.Add(GenerateLabelForTableValue(trail.Peak.ToString()), 1, 1); table.Children.Add(GenerateLabelForTableColumn("Season start"), 0, 2); table.Children.Add(GenerateLabelForTableValue(trail.SeasonStart), 1, 2); table.Children.Add(GenerateLabelForTableColumn("Season end"), 0, 3); table.Children.Add(GenerateLabelForTableValue(trail.SeasonEnd), 1, 3); table.Children.Add(GenerateLabelForTableColumn("Good For Kids"), 2, 0); if (trail.GoodForKids) table.Children.Add(GenericsContent.CreateIcon("icon_black_ood_for_kids.png"), 3, 0); table.Children.Add(GenerateLabelForTableColumn("Dog Allowed"), 2, 1); if (trail.DogAllowed) table.Children.Add(GenericsContent.CreateIcon("icon_black_dog_freindly.png"), 3, 1); table.Children.Add(GenerateLabelForTableColumn("Type"), 2, 2); if (!string.IsNullOrEmpty(trail.Type)) table.Children.Add(GenericsContent.CreateBlackIconByType(trail.Type), 3, 2); table.Children.Add(GenerateLabelForTableColumn("Duration Type"), 2, 3); if (!string.IsNullOrEmpty(trail.DurationType)) table.Children.Add(GenericsContent.CreateBlackIconByType(trail.DurationType), 3, 3); return table; }
private ScrollView GenerateMainScrollTrailPage(FullTrail trail) { var stack = new StackLayout { Orientation = StackOrientation.Vertical }; stack.Children.Add(GenerateGallery(trail.Photos)); stack.Children.Add(GenerateMainContentForTrailPage(trail)); return new ScrollView { Content = stack }; }
private ScrollView GenerateMainContentForTrailPage(FullTrail trail) { var stack = new StackLayout { Padding = new Thickness(30, 0), BackgroundColor = Color.White, }; stack.Children.Add(GenerateTrailNameLabel(trail.Name)); stack.Children.Add(GenerateTableForStaticOptions(trail)); stack.Children.Add(GenerateTableForOptions(trail)); stack.Children.Add(GenerateUpdateOptionButton()); stack.Children.Add(GenerateReferencesLabels(trail.References)); stack.Children.Add(GenericsContent.GenerateTextBlockWithHeader(nameof(trail.Description), trail.Description)); stack.Children.Add(GenericsContent.GenerateTextBlockWithHeader("Full description", trail.FullDescription)); stack.Children.Add(GenericsContent.GenerateTextBlockWithHeader("Why go?", trail.WhyGo)); stack.Children.Add(GenerateCommentsView(trail.Comments)); stack.Children.Add(GenerateCreatedCommentForm()); //stack.Children.Add(GenerateMap()); return new ScrollView { Content = stack }; }