public ForecastPage() { // Make ForecastPage in a StackLayout and give it colour ForecastLayout = new StackLayout { BackgroundColor = Color.FromHex("#B0BEC5") }; Title = "3 Day Forcast"; // Create Picker. Picker picker = new Picker { Title = "Select Your Mountain", VerticalOptions = LayoutOptions.CenterAndExpand, }; picker.BackgroundColor = Color.FromHex("#FAFAFA"); // Add Picker to Stacklayout and removed spacing, padding, and margin. StackLayout pickerLayout = new StackLayout { Padding = 0, Margin = 0, Spacing = 0, // Add each section of the page. Children = { picker, } }; // Add the Cooridnates to each mountain. foreach (string mountain in location.Keys) { picker.Items.Add(mountain); } picker.SelectedIndexChanged += (sender, args) => { string mountainSelected = picker.Items[picker.SelectedIndex]; coordinates latLong = location[mountainSelected]; string latitudeLongitude = latLong.Latitude + "," + latLong.Longitude; // API URL and KEY + Locations . parseForecast("http://api.wunderground.com/api/" + wunderground_key + "/geolookup/forecast/q/" + latitudeLongitude + ".json"); }; // Build the page by putting the picker and the Information Scroll View. this.Content = new StackLayout { Padding = 0, Margin = 0, Spacing = 0, // Add each section of the page. Children = { picker, new ScrollView { Content = ForecastLayout }, } }; }
public ConditionsPage() { Title = "Current Conditions"; // Create Picker. Picker picker = new Picker { Title = "Select Your Mountain", VerticalOptions = LayoutOptions.CenterAndExpand }; picker.BackgroundColor = Color.FromHex("#FAFAFA"); // Add Picker to Stacklayout and removed spacing, padding, and margin. StackLayout pickerLayout = new StackLayout { Padding = 0, Margin = 0, Spacing = 0, // Add each section of the page. Children = { picker, } }; mountainInfo = new TableView { Intent = TableIntent.Data, IsVisible = false, HeightRequest = 1750 }; mountainInfo.BackgroundColor = Color.FromHex("#78909C"); mountainInfoLayout = new StackLayout { // Create a Table for the Forecast Information to sit in and make it invisible until a mountain is selected. Children = { mountainInfo } }; avyInfo = new Label { Margin = new Thickness(10, 0, 10, 0) }; avyInfoLayout = new StackLayout { IsVisible = false, BackgroundColor = Color.FromHex("#ECEFF1"), Children = { avyInfo } }; // Add the Cooridnates to each mountain. foreach (string mountain in location.Keys) { picker.Items.Add(mountain); } // Create BoxView for displaying picked mountains picker.SelectedIndexChanged += (sender, args) => { avyInfoLayout.IsVisible = true; string mountainSelected = picker.Items[picker.SelectedIndex]; coordinates latLong = location[mountainSelected]; string latitudeLongitude = latLong.Latitude + "," + latLong.Longitude; // API URL and KEY + Locations . parseConditions("http://api.wunderground.com/api/" + wunderground_key + "/geolookup/conditions/q/" + latitudeLongitude + ".json", mountainInfo); parseAvalanche("https://api.rss2json.com/v1/api.json?rss_url=http%3A%2F%2Ffeeds.feedburner.com%2FVancouverIslandAvalancheBulletin%3Fformat%3Dxml", avyInfo); }; // Build the page. this.Content = new StackLayout { Padding = 0, Margin = 0, Spacing = 0, // Add each section of the page Children = { picker, mountainInfo, new ScrollView { Content = avyInfoLayout } } }; }