public HopListViewCell() { //Create label for hop name and bind it to "HopName" hopLabel = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; //Create label for AA Percentage Low and bind it to AALow aaPercentageLow = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; //Create label for AA Percentage High and bind it to AAHigh aaPercentageHigh = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; Orientation = StackOrientation.Horizontal; VerticalOptions = LayoutOptions.CenterAndExpand; Padding = new Thickness(5, 0, 10, 5); Spacing = 0; Children.Add(hopLabel); Children.Add(aaPercentageLow); Children.Add(aaPercentageHigh); }
public GrainListViewCell() { grainLabel = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; //Create label for SRM color and bind it to "srmColor" srmLabel = new WhiteTextColorLabel { VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 40, XAlign = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; //Create label for PPG and bind it to "PPG" ppgLabel = new WhiteTextColorLabel { VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = 50, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; Orientation = StackOrientation.Horizontal; VerticalOptions = LayoutOptions.CenterAndExpand; Padding = new Thickness(5, 0, 5, 5); Spacing = 0; Children.Add(grainLabel); Children.Add(srmLabel); Children.Add(ppgLabel); }
public IBUViewCell() { //Create label for hop name and bind it to "HopName" hopLabel = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.45), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; //Create label for AA Percentage Low and bind it to AALow aaPercentage = new HopThemedNumberEntry { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric, WidthRequest = (double)(App.ScreenWidth * 0.3), }; //Create label for AA Percentage High and bind it to AAHigh ounces = new HopThemedNumberEntry { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric, WidthRequest = (double)(App.ScreenWidth * 0.15) }; boilTime = new HopThemedNumberEntry { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric, WidthRequest = (double)(App.ScreenWidth * 0.15) }; VerticalOptions = LayoutOptions.CenterAndExpand; HorizontalOptions = LayoutOptions.FillAndExpand; Padding = new Thickness(5, 5, 5, 5); BackgroundColor = Color.Transparent; ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(5, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) }, }; Children.Add(hopLabel, 0, 1, 0, 1); Children.Add(aaPercentage, 1, 2, 0, 1); Children.Add(ounces, 2, 3, 0, 1); Children.Add(boilTime, 3, 4, 0, 1); }
private void LoadSubstitutes(string[] hopSubs) { foreach (string sub in hopSubs) { WhiteTextColorLabel beerName = new WhiteTextColorLabel { Text = sub, Font = Font.SystemFontOfSize(NamedSize.Medium), YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; hopSection.Add(new ViewCell { View = beerName }); } tableRoot.Add(hopSection); }
public MashViewHeader() { WhiteTextColorLabel grainNameLabel = new WhiteTextColorLabel { Text = "Grain Name", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.53), (double)(App.ScreenWidth * 0.48), (double)(App.ScreenWidth * 0.55)) }; WhiteTextColorLabel srmLabel = new WhiteTextColorLabel { Text = "SRM", XAlign = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.18), (double)(App.ScreenWidth * 0.15), (double)(App.ScreenWidth * 0.13)), }; WhiteTextColorLabel ppgLabel = new WhiteTextColorLabel { Text = "PPG", XAlign = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.12), (double)(App.ScreenWidth * 0.13), (double)(App.ScreenWidth * 0.15)), }; WhiteTextColorLabel poundsTimeLabel = new WhiteTextColorLabel { Text = "Pounds", XAlign = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.18), (double)(App.ScreenWidth * 0.15), (double)(App.ScreenWidth * 0.15)), }; Children.Add(grainNameLabel); Children.Add(srmLabel); Children.Add(ppgLabel); Children.Add(poundsTimeLabel); Orientation = StackOrientation.Horizontal; }
public void LoadCommercialBeers(string[] beers) { //Create a Label and add it to TableSection as a ViewCell for each beer in Commercial Beers string array foreach (string beer in beers) { WhiteTextColorLabel beerName = new WhiteTextColorLabel { Text = beer, YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; //Add View Cell to TableSection beerSection.Add(new ViewCell { View = beerName }); } //Add TableSection with commercial beers to TableRoot tableRoot.Add(beerSection); }
public IBUListViewHeader() { WhiteTextColorLabel hopNameLabel = new WhiteTextColorLabel { Text = "Hop Name", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.48), (double)(App.ScreenWidth * 0.5), (double)(App.ScreenWidth * 0.5) ) }; WhiteTextColorLabel aaLabel = new WhiteTextColorLabel { Text = "AA%", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.12), (double)(App.ScreenWidth * 0.14), (double)(App.ScreenWidth * 0.14) ) }; WhiteTextColorLabel ouncesLabel = new WhiteTextColorLabel { Text = "Ounces", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth * 0.17), (double)(App.ScreenWidth * 0.17), (double)(App.ScreenWidth * 0.15) ) }; WhiteTextColorLabel boilTimeLabel = new WhiteTextColorLabel { Text = "Boil Time", FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), WidthRequest = (double)(App.ScreenWidth * 0.2) }; Children.Add(hopNameLabel); Children.Add(aaLabel); Children.Add(ouncesLabel); Children.Add(boilTimeLabel); Orientation = StackOrientation.Horizontal; }
public CommercialBeersDetailPage(BeerStyle selected) { //Set the title on the navigation bar to the selected hop Title = "Commercial Beers"; //Set the StyleId for Xamarin Test Cloud StyleId = "CommercialBeersPage"; //Create Commercial Beer Examples TableView TableView commercialBeers = new TableView(); commercialBeers.BackgroundColor = Color.Transparent; //Split commercial beers from the passed in selected beer style string[] beers = selected.CommercialExamples.Split(','); //Create root and section for TableView TableRoot list = new TableRoot(); TableSection section = new TableSection(); //Foreach item in the commercial beers string, create a label and add it to TableView. foreach (string beer in beers) { WhiteTextColorLabel beerName = new WhiteTextColorLabel { Text = beer, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; //Add Viewcell containing commercial beers to TableSection of TableView section.Add(new ViewCell { View = beerName }); } //Add TableSection to Root list.Add(section); //Assign TableView Root to Commercial Beers TableView commercialBeers.Root = list; Content = commercialBeers; }
public BeerStylesListViewCell() { //Create label for beer name beerName = new WhiteTextColorLabel { XAlign = TextAlignment.Start, YAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.StartAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; abv = new WhiteTextColorLabel { XAlign = TextAlignment.Start, YAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.End, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; Padding = new Thickness(10, 0, 0, 0); Orientation = StackOrientation.Horizontal; Children.Add(beerName); Children.Add(abv); }
public HopDetails(Hops selectedHop) { //Set the title on the navigation bar to the selected hop Title = "Hop Details"; //Set the StyleId for Xamarin Test Cloud StyleId = "HopDetailsPage"; //Create items for Hop specifications ThemedLabel hopName = new ThemedLabel { Text = selectedHop.HopName, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; ThemedLabel hopAA = new ThemedLabel { Text = "Alpha Acid: " + selectedHop.AALow + " - " + selectedHop.AAHigh + "%" }; ThemedLabel hopType = new ThemedLabel { Text = "Type of hop: " + selectedHop.Type }; ThemedLabel hopSubstitutes = new ThemedLabel { Text = "Substitutes: " }; ThemedLabel hopDescription = new ThemedLabel { Text = selectedHop.Description, VerticalOptions = LayoutOptions.FillAndExpand }; //Create tableview for list of hop substitutes TableView hopSubs = new TableView(); hopSubs.BackgroundColor = Color.Transparent; //Split hop substitute string into array for tableview string[] substitutes = selectedHop.Substitutes.Split(','); //Create TableRoot and TableSection TableRoot list = new TableRoot(); TableSection section = new TableSection(); //Create a label for each hop substitute in string array of hop substitutes foreach (string sub in substitutes) { WhiteTextColorLabel beerName = new WhiteTextColorLabel { Text = sub, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; //Add ViewCell containing label to TableSection section.Add(new ViewCell { View = beerName }); } //Add Tablesection to TableRoot list.Add(section); //Set TableRoot to TableView hopSubs.Root = list; //Create Stacklayout for content page StackLayout detailsLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 20, Padding = new Thickness(5, 20, 5, 5), Children = { hopName, hopAA, hopType, hopDescription, hopSubstitutes, hopSubs } }; //Wrap content in scrollview var scrollLayer = new ScrollView(); scrollLayer.Content = detailsLayout; Content = scrollLayer; }
public MashViewCell() { //Create label for hop name and bind it to "HopName" WhiteTextColorLabel grainLabel = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.55), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; grainLabel.SetBinding(Label.TextProperty, new Binding("SelectedGrain.GrainName", BindingMode.OneWay, null, null, "{0}")); //Create label for AA Percentage Low and bind it to AALow WhiteTextColorLabel srm = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.13), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), XAlign = TextAlignment.Center }; srm.SetBinding(Label.TextProperty, new Binding("SelectedGrain.srmColor", BindingMode.OneWay, null, null, "{0}")); WhiteTextColorLabel ppg = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.15), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), XAlign = TextAlignment.Center }; ppg.SetBinding(Label.TextProperty, new Binding("SelectedGrain.PPG", BindingMode.OneWay, null, null, "{0}")); //Create label for AA Percentage High and bind it to AAHigh GrainThemedNumberEntry pounds = new GrainThemedNumberEntry { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric, WidthRequest = (double)(App.ScreenWidth * 0.15) }; pounds.SetBinding(Entry.TextProperty, new Binding("Pounds", BindingMode.TwoWay, null, null, "{0}")); pounds.Focused += (object sender, FocusEventArgs e) => { Handlefocus(pounds); }; pounds.Unfocused += (object sender, FocusEventArgs e) => { HandleUnfocused(pounds); }; VerticalOptions = LayoutOptions.CenterAndExpand; Padding = new Thickness(5, 0, 0, 5); BackgroundColor = Color.Transparent; ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(3, 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) }, }; Children.Add(grainLabel, 0, 1, 0, 1); Children.Add(srm, 1, 2, 0, 1); Children.Add(ppg, 2, 3, 0, 1); Children.Add(pounds, 3, 4, 0, 1); }
public BeerStyleDetailScrollPage(BeerStyle selected) { _selected = selected; //Set the title on the navigation bar to the selected hop Title = selected.Style; //Set the StyleId for Xamarin Test Cloud StyleId = selected.Style + "Page"; //Create button to navigate to commercial beers of beer style commercialBeers = new HopThemedButton { StyleId = "commercialBeersOfThisStyleButton", Text = "Commercial Beers of this style", WidthRequest = Device.OnPlatform( (double)(App.ScreenWidth), (double)(App.ScreenWidth), (double)(App.ScreenWidth * 0.8)), BorderColor = Color.Transparent, BorderRadius = Device.OnPlatform(0, 0, 0), HeightRequest = 50, Font = Font.SystemFontOfSize(NamedSize.Large) }; //Create Aroma labels and details CenteredBoldWhiteTextColorLabel aromaLabel = new CenteredBoldWhiteTextColorLabel { Text = "Aroma" }; WhiteTextColorLabel aroma = new WhiteTextColorLabel { Text = selected.Aroma }; //Create Appearance labels and details CenteredBoldWhiteTextColorLabel appearanceLabel = new CenteredBoldWhiteTextColorLabel { Text = "Appearance" }; WhiteTextColorLabel appearance = new WhiteTextColorLabel { Text = selected.Appearance }; //Create Flavor labels and details CenteredBoldWhiteTextColorLabel flavorLabel = new CenteredBoldWhiteTextColorLabel { Text = "Flavor" }; WhiteTextColorLabel flavor = new WhiteTextColorLabel { Text = selected.Flavor }; //Create Ingredients labels and details CenteredBoldWhiteTextColorLabel ingredientsLabel = new CenteredBoldWhiteTextColorLabel { Text = "Ingredients" }; WhiteTextColorLabel ingredients = new WhiteTextColorLabel { Text = selected.Ingredients }; //Create Comments labels and details CenteredBoldWhiteTextColorLabel commentsLabel = new CenteredBoldWhiteTextColorLabel { Text = "Comments" }; WhiteTextColorLabel comments = new WhiteTextColorLabel { Text = selected.Comments }; //Create srm Label CenteredBoldWhiteTextColorLabel srmColorLabel = new CenteredBoldWhiteTextColorLabel { Text = "Beer Color Range" }; //Stack all of the labels in a StackLayout StackLayout description = new StackLayout { Orientation = StackOrientation.Vertical, Children = { aromaLabel, aroma, appearanceLabel, appearance, flavorLabel, flavor, ingredientsLabel, ingredients, commentsLabel, comments, srmColorLabel } }; //Create Labels to label beer style specifications WhiteTextColorLabel ibuLabel = new WhiteTextColorLabel { Text = "IBU:", HorizontalOptions = LayoutOptions.End }; WhiteTextColorLabel ogLabel = new WhiteTextColorLabel { Text = "Original Gravity:", HorizontalOptions = LayoutOptions.End }; WhiteTextColorLabel fgLabel = new WhiteTextColorLabel { Text = "Final Gravity:", HorizontalOptions = LayoutOptions.End }; WhiteTextColorLabel abvLabel = new WhiteTextColorLabel { Text = "Alcohol Percent:", HorizontalOptions = LayoutOptions.End }; //Stack all of the labels vertically to create a left half StackLayout StackLayout labels = new StackLayout { Orientation = StackOrientation.Vertical, Children = { ibuLabel, ogLabel, fgLabel, abvLabel } }; //Create labels to hold the beer style specifications WhiteTextColorLabel ibu = new WhiteTextColorLabel { Text = selected.IBUs }; WhiteTextColorLabel og = new WhiteTextColorLabel { Text = selected.OG }; WhiteTextColorLabel fg = new WhiteTextColorLabel { Text = selected.FG }; WhiteTextColorLabel abv = new WhiteTextColorLabel { Text = selected.ABV + " %" }; //Stack all of the specs vertically to create a right half StackLayout StackLayout values = new StackLayout { Orientation = StackOrientation.Vertical, Children = { ibu, og, fg, abv } }; //Stack the two vertical layouts together to align the labels to the specifications StackLayout specs = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { labels, values } }; //split the srm range (ex. 10 - 24) to create a low SRM and High SRM. //The SRM calculator will use this string to change the background color of the low/high SRM labels string[] srmRange = selected.SRM.Split('-'); //Low SRM label created to pass into SRMColorCalculator WhiteTextColorLabel srmLow = new WhiteTextColorLabel { StyleId = "lowSRMLabel", Text = "Low SRM : " + srmRange [0], HorizontalOptions = LayoutOptions.CenterAndExpand, HeightRequest = 30, WidthRequest = 150, YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; //High SRM label created to pass into SRMColorCalculator WhiteTextColorLabel srmHigh = new WhiteTextColorLabel { StyleId = "highSRMLabel", Text = "High SRM : " + srmRange [1], HorizontalOptions = LayoutOptions.CenterAndExpand, HeightRequest = 30, WidthRequest = 150, YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; //Pass both the low and high SRM labels into the calculator //The calculator will change the background color of the labels. srmCalculator.SRMColorCalculator(srmLow, srmHigh); //Put the colored srm labels next to each other StackLayout srmLabels = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { srmLow, srmHigh } }; //Put all of the elements together to create the fullStack StackLayout halfStack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(10, 10, 10, 10), Children = { description, srmLabels, specs, } }; StackLayout fullStack = new StackLayout { Children = { commercialBeers, halfStack, } }; //Wrap the fullStack in a scrollview Content = new ScrollView { Content = fullStack }; }
public MissionControlPage() { //Set the title on the navigation bar to the selected hop Title = "BrewMate Toolbelt"; //Set the StyleId for Xamarin Test Cloud StyleId = "BrewMateToolbelt"; //Create the buttons to navigate to application functions ibuCalculator = new HopThemedButton { StyleId = "ibuCalculatorButton", Text = "IBU Caluclator", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; SRMCalculator = new HopThemedButton { StyleId = "mashCalculatorButton", Text = "Mash Calculator", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; aaPercentageCalculator = new HopThemedButton { StyleId = "alcoholPercentageCalculatorButton", Text = "Alcohol Percentage Calculator", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; grainDescriptions = new HopThemedButton { StyleId = "grainDescriptionsButton", Text = "Grain Descriptions", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; hopDescriptions = new HopThemedButton { StyleId = "hopGuideButton", Text = "Hop Guide", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; beerStyles = new HopThemedButton { StyleId = "beerStylesButton", Text = "Beer Styles", HeightRequest = (double)(App.ScreenHeight * 0.1), WidthRequest = (double)(App.ScreenWidth * 0.8) }; haveBeer = new WhiteTextColorLabel { Text = "Don't worry, I'm here to help!\nGo ahead and have another beer...", XAlign = TextAlignment.Center, VerticalOptions = LayoutOptions.End, }; //Add all buttons to a stacklayout buttonCollection = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, Spacing = 10, Opacity = 0, Children = { beerStyles, ibuCalculator, SRMCalculator, aaPercentageCalculator, grainDescriptions, hopDescriptions, } }; }