public ParentsEveningPage () {

			List<PickerEntry> accountEntries = Utils.getAccountPickerEntries ();
			accountPicker = new ExtendedPicker {
				ItemsSource = accountEntries,
				DisplayProperty = "entryDisplay",
				BackgroundColor = Color.Gray
			};
			accountPicker.SelectedIndexChanged += async (sender, e) => {
				meetingPickerView.IsVisible = false;
				int accountID = ((PickerEntry)accountPicker.SelectedItem).entryValue;
				List<PickerEntry> meetings = await OnlineDataLoader.getParentsEveningMeetingsForAccount (accountID);
				meetingPicker = new ExtendedPicker {
					ItemsSource = meetings,
					DisplayProperty = "entryDisplay",
					BackgroundColor = Color.Gray
				}; 
				meetingPickerView.IsVisible = true;
			};

			meetingPicker = new ExtendedPicker {
				BackgroundColor = Color.Gray
			};

			accountPickerView = new StackLayout {
				Children = {
					accountPicker
				}
			};
			meetingPickerView = new StackLayout {
				IsVisible = false,
				Children = {
					meetingPicker
				}
			};

			StackLayout mainLayout = new StackLayout {
				Padding = new Thickness(20),
				HorizontalOptions = LayoutOptions.FillAndExpand,
				VerticalOptions = LayoutOptions.FillAndExpand,
				BackgroundColor = Color.White,
				Children = {
					accountPickerView,
					meetingPickerView
				}
			};

			this.Content = mainLayout;

		}
Пример #2
0
		public AddressPage (UserInfo userInfo, Address address, CountryDropdownSet countryTree) {
			Title = "Address";
			titleEntry = new Entry {
				Text = userInfo.title,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			firstNameEntry = new Entry {
				Text = userInfo.firstName,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			lastNameEntry = new Entry {
				Text = userInfo.lastName,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressOneEntry = new Entry {
				Text = address.address1,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressTwoEntry = new Entry {
				Text = address.address2,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressTownEntry = new Entry {
				Text = address.city,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressCountyEntry = new Entry {
				Text = address.state,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressPostcodeEntry = new Entry {
				Text = address.postcode,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			addressCountryPicker = new Picker {	
				HorizontalOptions = LayoutOptions.FillAndExpand
			};
			CountryDropdownEntry selected = null;
			foreach (CountryDropdownEntry c in countryTree) {				
				addressCountryPicker.Items.Add (c.name);
				if (c.code.Equals (address.country)) {
					selected = c;
				}
			}

			addressCountryPickerTest = new ExtendedPicker {
				//ItemsSource = countryTree,
				SelectedItem = selected,
				DisplayProperty = "name",
				HorizontalOptions = LayoutOptions.FillAndExpand				
			};

			//if (!String.IsNullOrWhiteSpace (selected)) {
			//	for (int i = 0; i < addressCountryPicker.Items.Count - 1; i++) {
			//		if (addressCountryPicker.Items [i].Equals (selected)) {
			//			addressCountryPicker.SelectedIndex = i;
			//		}
			//	}
			//}
				
			titleEntry.Completed += async (sender, e) => await updateInfo ();
			firstNameEntry.Completed += async (sender, e) => await updateInfo();
			lastNameEntry.Completed += async (sender, e) => await updateInfo();
			addressOneEntry.Completed += async (sender, e) => await updateInfo();
			addressTwoEntry.Completed += async (sender, e) => await updateInfo();
			addressTownEntry.Completed += async (sender, e) => await updateInfo();
			addressCountyEntry.Completed += async (sender, e) => await updateInfo();
			addressPostcodeEntry.Completed += async (sender, e) => await updateInfo();
			addressCountryPicker.SelectedIndexChanged += async (sender, e) => await updateInfo();
			addressCountryPickerTest.SelectedIndexChanged += async (sender, e) => await updateInfo();
		}