public UserNotificationSettingsPage() { Title = "Settings"; try { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("In User Notification Settings Page", "Setting Title", 0, GlobalData.loginData); ReturnButton.Clicked += ReturnButton_Clicked; PhoneCarrierPicker.Title = "Select a carrier:"; _client.GetUserOptInSettingsCompleted += ClientUserOptInSettingsCompleted; _client.GetUserOptInSettingsAsync(GlobalData.loginData.UserName, GlobalData.loginData); while (UserSettings.UserName == string.Empty) { Task.Delay(100).Wait(); } _client.GetCarrierTextMappingsCompleted += ClientCarrierTextMappingsCompleted; _client.GetCarrierTextMappingsAsync(GlobalData.loginData); while (CarrierTextMappings.Count < 1) { Task.Delay(100).Wait(); } foreach (KeyValuePair <int, OMGITWebServices.OMGNotifyCarrierTextMapping> entry in CarrierTextMappings) { PhoneCarrierPicker.Items.Add(entry.Value.CarrierDisplayName.ToString()); } _client.GetValidLocationsCompleted += ClientValidLocationsCompleted; _client.GetValidLocationsAsync(GlobalData.loginData); while (ValidLocations.Count < 1) { Task.Delay(100).Wait(); } _client.GetUserClinicsForNotificationsCompleted += ClientGetUserClinicsForNotificationsCompleted; _client.GetUserClinicsForNotificationsAsync(GlobalData.loginData.UserName, GlobalData.loginData); while (UClinics == null) { Task.Delay(100).Wait(); } foreach (KeyValuePair <int, string> entry in ValidLocations) { StackLayout ClinicLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill }; if (UClinics.Contains(entry.Key)) { ClinicLayout.Children.Add(new Switch { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, IsToggled = true }); } else { ClinicLayout.Children.Add(new Switch { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center }); } ClinicLayout.Children.Add(new Label { Text = entry.Value, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, TextColor = Color.White }); ClinicLayout.Children.Add(new Label { Text = entry.Key.ToString(), HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, IsVisible = false }); AllClinicsLayout.Children.Add(ClinicLayout); } int index = 0; int CarrierID = UserSettings.CarrierID; foreach (KeyValuePair <int, OMGITWebServices.OMGNotifyCarrierTextMapping> entry in CarrierTextMappings) { if (entry.Key == CarrierID) { break; } index += 1; } PhoneCarrierPicker.SelectedIndex = index; if (UserSettings.TextMessagingOK == 1) { AllowTextMessageSwitch.IsToggled = true; } if (UserSettings.EmailOK == 1) { AllowEmailSwitch.IsToggled = true; } CellPhoneEntry.Text = UserSettings.CellPhoneNumber; EmailEntry.Text = UserSettings.EmailAddress; Submit.Clicked += Submit_Clicked; Logout.Clicked += Logout_Clicked; NotificationSettingsLayout.Children.Add(Logout); PhoneCarrierLayout.Children.Add(PhoneCarrierLabel); PhoneCarrierLayout.Children.Add(PhoneCarrierPicker); NotificationSettingsLayout.Children.Add(PhoneCarrierLayout); AllowTextMessageLayout.Children.Add(AllowTextMessageLabel); AllowTextMessageLayout.Children.Add(AllowTextMessageSwitch); NotificationSettingsLayout.Children.Add(AllowTextMessageLayout); CellPhoneLayout.Children.Add(CellPhoneLabel); CellPhoneLayout.Children.Add(CellPhoneEntry); NotificationSettingsLayout.Children.Add(CellPhoneLayout); AllowEmailLayout.Children.Add(AllowEmailLabel); AllowEmailLayout.Children.Add(AllowEmailSwitch); NotificationSettingsLayout.Children.Add(AllowEmailLayout); EmailLayout.Children.Add(EmailLabel); EmailLayout.Children.Add(EmailEntry); NotificationSettingsLayout.Children.Add(EmailLayout); NotificationSettingsLayout.Children.Add(SelectClinicLabel); NotificationSettingsLayout.Children.Add(AllClinicsLayout); NotificationSettingsLayout.Children.Add(Submit); NotificationSettingsView.Content = NotificationSettingsLayout; Content = NotificationSettingsView; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); } catch (Exception ex) { _client.AddLogMessageMobileAsync("In UserNotificationSettings Page. Error: ", ex.Message.ToString(), 0, GlobalData.loginData); } }