public MessageHistoryPage() { Title = "History"; _client = new OMGITServiceClient(binding, EndPoint); _client.GetRecentMessagesAsync(); _client.GetRecentMessagesCompleted += ClientOnGetMessagesCompleted; while (msgs[0] == null) { continue; } foreach (string m in msgs) { historyLayout.Children.Add(new Frame { Padding = 3, Content = new Label { Text = m, FontSize = 20, TextColor = Color.White }, BackgroundColor = Color.FromHex("1a1a1a"), OutlineColor = Color.FromHex("14986D") }); } ScrollView historyView = new ScrollView { Content = historyLayout }; Content = historyView; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); }
protected override void OnCreate(Bundle bundle) { OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageTickerAppAsync("Reached OnCreate", string.Empty); base.OnCreate(bundle); /* * //To Do - acknowledge the message with a web service call to * BasicHttpBinding binding = new BasicHttpBinding * { * Name = "basicHttpBinding", * MaxBufferSize = 2147483647, * MaxReceivedMessageSize = 2147483647 * }; * TimeSpan timeout = new TimeSpan(0, 0, 30); * binding.SendTimeout = timeout; * binding.OpenTimeout = timeout; * binding.ReceiveTimeout = timeout; */ global::Xamarin.Forms.Forms.Init(this, bundle); string confirmToken = this.Intent.GetStringExtra("confirmToken"); string alertMessage = this.Intent.GetStringExtra("alertMessage"); if (confirmToken != null && alertMessage != null) { LoadApplication(new App(alertMessage)); _client.AcknowledgeNotificationAsync(confirmToken, GlobalData.loginData); } else { LoadApplication(new App()); } try { // Check to ensure everything's setup right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog("There was an error creating the Mobile Service. Verify the URL", "Error"); } catch (Exception e) { CreateAndShowDialog(e.Message, "Error"); } }
public TestSendPage() { _client = new OMGITServiceClient(binding, EndPoint); TestSendButton.Clicked += TestSendButton_Clicked; MainPageButton.Clicked += MainPageButton_Clicked; TestSendFrame.Content = TestSendButton; MainPageFrame.Content = MainPageButton; LabelFrame.Content = FinishLabel; TestSendLayout.Children.Add(TestSendFrame); Content = TestSendLayout; }
private void testPush_Clicked(object sender, EventArgs e) { OMGITWebServices.OMGAdminTestSendData testSendData = new OMGITWebServices.OMGAdminTestSendData(); testSendData.Message = testMessage.Text; testSendData.Tag = testTags.Text; testSendData.OperatingSystem = Device.OS.ToString(); OMGITWebServices.OMGPushNotificationSendData OMGSendData = new OMGITWebServices.OMGPushNotificationSendData(); OMGSendData.Message = testMessage.Text; OMGSendData.Tag = testTags.Text; OMGSendData.OperatingSystem = Device.OS.ToString(); _client = new OMGITServiceClient(binding, EndPoint); // _client.TestSendNotificationAsync(testSendData); _client.SendNotificationAsync(OMGSendData, GlobalData.loginData); DisplayAlert("Test Send", "Test push was successfully sent to " + testTags.Text, "Close"); }
public AdminPage() { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("In Admin Page", "", 0, GlobalData.loginData); Title = "Admin"; sendTestPush.Clicked += testPush_Clicked; adminLayout.Children.Add(testMessage); adminLayout.Children.Add(testTags); adminLayout.Children.Add(sendTestPush); ScrollView adminView = new ScrollView { BackgroundColor = Color.Black, Content = adminLayout }; Content = adminView; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); _client.AddLogMessageMobileAsync("In Admin Page", "Page created", 0, GlobalData.loginData); }
private void SendNotification_Clicked(object sender, EventArgs e) { OMGITWebServices.OMGLocationNotificationMessage lm = new OMGITWebServices.OMGLocationNotificationMessage(); lm.Message = NotificationMessage.Text; lm.Subject = SubjectMessage.Text; string selLocation = (string)LocationPicker.Items[LocationPicker.SelectedIndex]; foreach (KeyValuePair <int, string> entry in validLocations) { if (entry.Value == selLocation) { lm.ClinicID = entry.Key; } } // lm.ClinicID = 8; _client = new OMGITServiceClient(binding, EndPoint); _client.SendOMGNotificationToLocationsAsync(lm, GlobalData.loginData); DisplayAlert("NotificationSent", "Location Notification was successfully sent", "Close"); }
private void SendNotification_Clicked(object sender, EventArgs e) { OMGITWebServices.OMGLocationNotificationMessage lm = new OMGITWebServices.OMGLocationNotificationMessage(); lm.Message = NotificationMessage.Text; lm.Subject = SubjectMessage.Text; //string selLocation = (string)LocationPicker.Items[LocationPicker.SelectedIndex]; //foreach (KeyValuePair<int, string> entry in ValidLocations) //{ // if (entry.Value == selLocation) // lm.ClinicID = entry.Key; //} // lm.ClinicID = 8; List <int> SendClinicIDs = new List <int>(); foreach (StackLayout s in AllClinicsLayout.Children) { var curClinicName = s.Children[1] as Label; var curID = s.Children[2] as Label; var curSwitch = s.Children[0] as Switch; if (curSwitch.IsToggled) { try { SendClinicIDs.Add(Int32.Parse(curID.Text)); } catch (Exception ex) {; } } } foreach (int id in SendClinicIDs) { lm.ClinicID = id; _client = new OMGITServiceClient(binding, EndPoint); _client.SendOMGNotificationToLocationsAsync(lm, GlobalData.loginData); DisplayAlert("NotificationSent", "Location Notification was successfully sent", "Close"); } }
public LocationNotificationSendPage() { Title = "Notify"; locationLabel.Text = "Location to Send to:"; _client = new OMGITServiceClient(binding, EndPoint); //System.Collections.Generic.SortedDictionary<int,string> validLocations = (SortedDictionary<int,string>) _client.GetValidSendLocationsCompleted += ClientSendLocationsCompleted; _client.GetValidSendLocationsAsync(GlobalData.loginData); LocationPicker.Title = "Select Location to Send to:"; while (validLocations.Count < 1) { Task.Delay(100).Wait(); } foreach (KeyValuePair <int, string> entry in validLocations) { LocationPicker.Items.Add(entry.Value); } sendNotificationPush.Clicked += SendNotification_Clicked; adminLayout.Children.Add(SubjectMessage); adminLayout.Children.Add(NotificationMessage); adminLayout.Children.Add(locationLabel); adminLayout.Children.Add(LocationPicker); adminLayout.Children.Add(sendNotificationPush); ScrollView adminView = new ScrollView { BackgroundColor = Color.FromHex("14986D"), Content = adminLayout }; Content = adminView; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); }
public override void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action <UIBackgroundFetchResult> completionHandler) { NSDictionary aps = userInfo.ObjectForKey(new NSString("aps")) as NSDictionary; //NSString trackid = userInfo.ObjectForKey(new NSString("trackid")) as NSString; //string track = string.Empty; if (aps.ContainsKey(new NSString("alert"))) { alert = (aps[new NSString("alert")] as NSString).ToString(); } if (aps.ContainsKey(new NSString("alertMessage"))) { alertMessage = (aps[new NSString("alertMessage")] as NSString).ToString(); } if (aps.ContainsKey(new NSString("confirmToken"))) { confirmToken = (aps[new NSString("confirmToken")] as NSString).ToString(); } //if (trackid != null) // track = trackid.ToString(); //show alert if (!string.IsNullOrEmpty(alert)) { UIAlertView avAlert = new UIAlertView("Notification", alert, null, "OK", null); avAlert.Show(); avAlert.Clicked += changePage; OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); _client.AcknowledgeNotificationAsync(confirmToken, GlobalData.loginData); } }
private async void Submit_Clicked(object sender, EventArgs e) { submit.IsEnabled = false; if (Application.Current.Properties.ContainsKey("DeviceToken")) { string DeviceToken = Application.Current.Properties["DeviceToken"] as string; } try { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageTickerAppAsync("Reached Submit_Clicked", "test"); var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location); if (status == PermissionStatus.Granted) { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; var position = await locator.GetPositionAsync(timeoutMilliseconds : 10000); latitude = position.Latitude.ToString(); longitude = position.Longitude.ToString(); altitude = position.Altitude.ToString(); Debug.WriteLine("Position Status: {0}", position.Timestamp); Debug.WriteLine("Position Latitude: {0}", position.Latitude); Debug.WriteLine("Position Longitude: {0}", position.Longitude); } } catch (Exception ex) { Debug.WriteLine("Unable to get location, may need to increase timeout: " + ex); } OMGITWebServices.OMGLoginData loginData = new OMGITWebServices.OMGLoginData(); loginData.UserName = usernameEntry.Text.Trim().ToLower(); loginData.Password = passwordEntry.Text; string alertMessage = alert.Text; loginData.OMGAppID = Constants.AppName; loginData.Altitude = altitude; loginData.Latitude = latitude; loginData.Longitude = longitude; if (Device.OS == TargetPlatform.iOS) { loginData.MobilePlatform = "iOS"; } else if (Device.OS == TargetPlatform.Android) { loginData.MobilePlatform = "Android"; } else { loginData.MobilePlatform = "Unknown Platform"; } loginData.PhoneIdentifier = DependencyService.Get <IGetDeviceInfo>().GetDeviceInfo(); if (keepLoggedInSwitch.IsToggled) { loginData.CreateAuthToken = true; } GlobalData.SetLoginData(loginData); await Task.Run(() => { _client = new OMGITServiceClient(binding, EndPoint); _client.LoginAsync(loginData); _client.LoginCompleted += ClientOnLoginCompleted; }); try { while (returnMessage.ErrorMessage == null) { continue; } if (returnMessage.Success) { if (keepLoggedInSwitch.IsToggled) { var data = loginData.UserName; var salt = Crypto.CreateSalt(16); var bytes = Crypto.EncryptAes(returnMessage.AuthToken, data, salt); Application.Current.Properties["LastLoggedInUser"] = loginData.UserName; Application.Current.Properties[loginData.UserName + "Token"] = bytes; Application.Current.Properties[loginData.UserName + "Salt"] = salt; await Application.Current.SavePropertiesAsync(); } OMGITWebServices.OMGInstallationData installData = new OMGITWebServices.OMGInstallationData(); if (Application.Current.Properties.ContainsKey("DeviceToken")) { installData.DeviceToken = Application.Current.Properties["DeviceToken"] as string; } installData.Username = loginData.UserName; installData.OperatingSystem = loginData.MobilePlatform; await Task.Run(() => { _client = new OMGITServiceClient(binding, EndPoint); _client.RegisterForNotificationsAsync(installData); _client.RegisterForNotificationsCompleted += ClientOnRegisterCompleted; }); if (loginData.UserName == "hfowler" || loginData.UserName == "dfowler" || loginData.UserName == "sliu" || loginData.UserName == "khellwege") { if (alertMessage != "") { await Navigation.PushModalAsync(new AdminMainPage(alertMessage)); } else { await Navigation.PushModalAsync(new AdminMainPage()); } } else { if (alertMessage != "") { await Navigation.PushModalAsync(new TickerDisplayPage(alertMessage)); } else { await Navigation.PushModalAsync(new TickerDisplayPage()); } } } else { if (incorrectPasswords == 0) { Label errorMessage = new Label { Text = returnMessage.ErrorMessage, TextColor = Color.Red, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White }; loginForm.Children.Add(errorMessage); } returnMessage.ErrorMessage = null; incorrectPasswords += 1; submit.IsEnabled = true; } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public ManageEmployeeSignUpsPage() { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("In Manage Employee Sign UPs Page", "", 0, GlobalData.loginData); //HeaderLayout.Children.Add(RemoveLabel); //HeaderLayout.Children.Add(HistoryLabel); //HeaderLayout.Children.Add(ClinicNameLabel); //HeaderLayout.Children.Add(EmployeeLabel); ManageGrid.RowDefinitions.Add(new RowDefinition { Height = 25 }); int i = 1; while (i <= PageSize + 1) { ManageGrid.RowDefinitions.Add(new RowDefinition { Height = 35 }); i += 1; } ManageGrid.RowDefinitions.Add(new RowDefinition { Height = 35 }); ManageGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ManageGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ManageGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ManageGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ManageGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ManageGrid.Children.Add(RemoveLabel, 0, 0); ManageGrid.Children.Add(HistoryLabel, 1, 0); ManageGrid.Children.Add(ClinicNameLabel, 2, 4, 0, 1); ManageGrid.Children.Add(EmployeeLabel, 4, 0); // ManageLayout.Children.Add(HeaderLayout); _client.Report_GetUserSignUpsWithTableIDCompleted += ClientReport_GetUserSignUpsWithTableIDCompleted; _client.Report_GetUserSignUpsWithTableIDAsync(GlobalData.loginData); while (UserLocations.Count < 1) { continue; } NumPages += UserLocations.Count / PageSize; i = 1; int remainder = UserLocations.Count % PageSize; while (i < NumPages) { System.Collections.Generic.Dictionary <int, OMGITWebServices.OMGUserSignupReportRow> temp = UserLocations.Skip((i - 1) * PageSize).Take(PageSize).ToDictionary(x => x.Key, x => x.Value); UserLocationsList.Add(temp); i += 1; } System.Collections.Generic.Dictionary <int, OMGITWebServices.OMGUserSignupReportRow> lastPage = UserLocations.Skip((i - 1) * PageSize).Take(remainder).ToDictionary(x => x.Key, x => x.Value); UserLocationsList.Add(lastPage); i = 1; foreach (KeyValuePair <int, OMGITWebServices.OMGUserSignupReportRow> kvp in UserLocationsList[0]) { Dictionary <int, string> DeleteArg = new Dictionary <int, string>(); DeleteArg.Add(kvp.Key, kvp.Value.EmployeeName); //var row = new StackLayout { Orintation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center }; var EmpName = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), Text = kvp.Value.EmployeeName, TextColor = Color.White, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill }; var ClinicName = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), Text = kvp.Value.ClinicName, TextColor = Color.White, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill }; var DeleteButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, Text = "Delete", CommandParameter = DeleteArg }; var ViewButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, Text = "View", CommandParameter = kvp.Value.EmployeeName }; DeleteButton.Clicked += DeleteButton_Clicked; ViewButton.Clicked += ViewButton_Clicked; ManageGrid.Children.Add(DeleteButton, 0, i); ManageGrid.Children.Add(ViewButton, 1, i); Grid.SetColumnSpan(ClinicName, 2); ManageGrid.Children.Add(ClinicName, 2, 4, i, i + 1); ManageGrid.Children.Add(EmpName, 4, i); i += 1; //row.Children.Add(DeleteButton); //row.Children.Add(ViewButton); //row.Children.Add(ClinicName); //row.Children.Add(tableID); //row.Children.Add(EmpName); //ManageLayout.Children.Add(row); } //ManageLayout.Children.Add(FooterLayout); //Grid.SetColumnSpan(FooterLayout, 4); var FirstPageButton = new Button(); var PrevPageButton = new Button(); var CurPageButton = new Button(); var NextPageButton = new Button(); var LastPageButton = new Button(); if (Device.OS == TargetPlatform.Android) { FirstPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "<<", IsEnabled = false }; PrevPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "< Prev", IsEnabled = false }; CurPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = CurrentPage.ToString() + "/" + NumPages.ToString() }; if (NumPages == 1) { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "Next >", IsEnabled = false }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = ">>", IsEnabled = false }; } else { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "Next >" }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = ">>" }; } } else { FirstPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "<<", IsEnabled = false }; PrevPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "< Prev", IsEnabled = false }; CurPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = CurrentPage.ToString() + "/" + NumPages.ToString() }; if (NumPages == 1) { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "Next >", IsEnabled = false }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = ">>", IsEnabled = false }; } else { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "Next >" }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = ">>" }; } } FirstPageButton.Clicked += FirstPageButton_Clicked; PrevPageButton.Clicked += PrevPageButton_Clicked; NextPageButton.Clicked += NextPageButton_Clicked; LastPageButton.Clicked += LastPageButton_Clicked; //FooterLayout.Children.Add(FirstPageButton); //FooterLayout.Children.Add(PrevPageButton); //FooterLayout.Children.Add(CurPageButton); //FooterLayout.Children.Add(NextPageButton); //FooterLayout.Children.Add(LastPageButton); ManageGrid.Children.Add(FirstPageButton, 0, PageSize + 2); ManageGrid.Children.Add(PrevPageButton, 1, PageSize + 2); ManageGrid.Children.Add(CurPageButton, 2, PageSize + 2); ManageGrid.Children.Add(NextPageButton, 3, PageSize + 2); ManageGrid.Children.Add(LastPageButton, 4, PageSize + 2); //ManageGrid.Children.Add(FooterLayout, 0, 3, 102, 103); //ManageScrollView.Content = ManageLayout; Logout.Clicked += Logout_Clicked; ManageLayout.Children.Add(Logout); ManageLayout.Children.Add(ManageGrid); ManageScrollView.Content = ManageLayout; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); Content = ManageScrollView; }
public App() { OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); // _client.AddLogMessageTickerAppAsync("Reached App", "Contains Last Log in: " + Application.Current.Properties.ContainsKey("LastLoggedInUser").ToString()); _client.AddLogMessageMobileAsync("Reached App version: " + GlobalData.OMGAppVersion, Helpers.Settings.UserName, 0, GlobalData.loginData); byte[] token = null; byte[] salt = null; string username = string.Empty; string authToken = string.Empty; OMGITWebServices.OMGAuthTokenData atd = new OMGITWebServices.OMGAuthTokenData(); //if (Application.Current.Properties.ContainsKey("LastLoggedInUser")) if (Helpers.Settings.UserName != string.Empty) { //username = Application.Current.Properties["LastLoggedInUser"] as string; username = Helpers.Settings.UserName; atd.UserName = username; _client.AddLogMessageMobileAsync("Last Logged In User:"******"Token")) if (Helpers.Settings.AuthToken != string.Empty) { //token = Application.Current.Properties[username + "Token"] as byte[]; token = Convert.FromBase64String(Helpers.Settings.AuthToken); } //Check to make sure a salt exists for the last logged in user //if (Application.Current.Properties.ContainsKey(username + "Salt")) if (Helpers.Settings.Salt != string.Empty) { //salt = Application.Current.Properties[username + "Salt"] as byte[]; salt = Convert.FromBase64String(Helpers.Settings.Salt); } //If both the token and salt exist decrypt the token if (token != null && salt != null) { authToken = Crypto.DecryptAes(token, username, salt); atd.AuthToken = authToken; } } atd.MobilePlatform = Device.OS.ToString(); atd.OMGAppID = Constants.AppName; atd.PhoneIdentifier = DependencyService.Get <IGetDeviceInfo>().GetDeviceInfo(); _client.ValidateAuthenticationTokenAsync(atd); _client.ValidateAuthenticationTokenCompleted += completedValidation; while (orm.ErrorMessage == "None" || orm.ErrorMessage == null) { continue; } //If the token is a valid non-expired token open the TickerDisplayPage page if not open the Login page if (orm.Success) { OMGITWebServices.OMGLoginData loginData = new OMGITWebServices.OMGLoginData(); loginData.UserName = username; loginData.OMGAppID = Constants.AppName + GlobalData.OMGAppVersion; if (Device.OS == TargetPlatform.iOS) { loginData.MobilePlatform = "iOS"; } else if (Device.OS == TargetPlatform.Android) { loginData.MobilePlatform = "Android"; } else { loginData.MobilePlatform = "Unknown Platform"; } loginData.PhoneIdentifier = DependencyService.Get <IGetDeviceInfo>().GetDeviceInfo(); GlobalData.SetLoginData(loginData); string ipaddress = DependencyService.Get <IIPAddressManager>().GetIPAddress(); _client.GetNotificationAdminsAsync(loginData); _client.GetNotificationAdminsCompleted += ClientNotificationAdminsCompleted; while (NotificationAdmins == null) { continue; } bool isAdmin = false; foreach (string s in NotificationAdmins) { if (loginData.UserName == s) { isAdmin = true; break; } } if (isAdmin) { MainPage = new NavigationPage(new AdminMainPage()); } else { MainPage = new NavigationPage(new UserNotificationSettingsPage()); } } else { // The root page of your application MainPage = new LoginPage(); } }
public App(string alertMessage) { OMGITServiceClient _client; EndpointAddress EndPoint = new EndpointAddress("https://webapps.oregonmed.net/OMGITWebservices/OMGMobileServices.svc"); BasicHttpBinding binding = CreateBasicHttp(); _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageTickerAppAsync("Reached App tickerPage overload", "Contains Last Log in: " + Application.Current.Properties.ContainsKey("LastLoggedInUser").ToString()); byte[] token = null; byte[] salt = null; string username = string.Empty; string authToken = string.Empty; OMGITWebServices.OMGAuthTokenData atd = new OMGITWebServices.OMGAuthTokenData(); if (Application.Current.Properties.ContainsKey("LastLoggedInUser")) { username = Application.Current.Properties["LastLoggedInUser"] as string; atd.UserName = username; _client.AddLogMessageTickerAppAsync("Last Logged In User:"******"Token")) { token = Application.Current.Properties[username + "Token"] as byte[]; } //Check to make sure a salt exists for the last logged in user if (Application.Current.Properties.ContainsKey(username + "Salt")) { salt = Application.Current.Properties[username + "Salt"] as byte[]; } //If both the token and salt exist decrypt the token if (token != null && salt != null) { authToken = Crypto.DecryptAes(token, username, salt); atd.AuthToken = authToken; } } atd.MobilePlatform = Device.OS.ToString(); atd.OMGAppID = Constants.AppName; atd.PhoneIdentifier = DependencyService.Get <IGetDeviceInfo>().GetDeviceInfo(); _client.ValidateAuthenticationTokenAsync(atd); _client.ValidateAuthenticationTokenCompleted += completedValidation; while (orm.ErrorMessage == "None" || orm.ErrorMessage == null) { continue; } //If the token is a valid non-expired token open the TickerDisplayPage page if not open the Login page if (orm.Success) { if (username == "hfowler" || username == "dfowler" || username == "sliu" || username == "khellwege") { MainPage = new NavigationPage(new AdminMainPage(alertMessage)); } else { MainPage = new NavigationPage(new TickerDisplayPage(alertMessage)); } } else { // The root page of your application MainPage = new NavigationPage(new LoginPage(alertMessage)); } }
public ManageExternalUsersPage() { _client = new OMGITServiceClient(binding, EndPoint); }
private async void Submit_Clicked(object sender, EventArgs e) { submit.IsEnabled = false; if (Application.Current.Properties.ContainsKey("DeviceToken")) { string DeviceToken = Application.Current.Properties["DeviceToken"] as string; } try { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("Reached Submit_Clicked in Login Page", "", 0, GlobalData.loginData); // _client.AddLogMessageTickerAppAsync("Reached Submit_Clicked in LoginPage", ""); var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location); if (status == PermissionStatus.Granted) { var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; var position = await locator.GetPositionAsync(timeoutMilliseconds : 10000); latitude = position.Latitude.ToString(); longitude = position.Longitude.ToString(); altitude = position.Altitude.ToString(); Debug.WriteLine("Position Status: {0}", position.Timestamp); Debug.WriteLine("Position Latitude: {0}", position.Latitude); Debug.WriteLine("Position Longitude: {0}", position.Longitude); } } catch (Exception ex) { Debug.WriteLine("Unable to get location, may need to increase timeout: " + ex); } OMGITWebServices.OMGLoginData loginData = new OMGITWebServices.OMGLoginData(); string dontuseForLogin1 = "@oregonmed.net"; string dontuseForLogin2 = "omgnet"; if (usernameEntry.Text.Trim().ToLower().Contains(dontuseForLogin1) || usernameEntry.Text.Trim().ToLower().Contains(dontuseForLogin2)) { await DisplayAlert("Only enter your username", "Don't use @oregonmed.net or OMGNET", "Close"); submit.IsEnabled = true; return; } loginData.UserName = usernameEntry.Text.Trim().ToLower(); loginData.Password = passwordEntry.Text; string alertMessage = alert.Text; loginData.OMGAppID = Constants.AppName + GlobalData.OMGAppVersion; loginData.Altitude = altitude; loginData.Latitude = latitude; loginData.Longitude = longitude; if (Device.OS == TargetPlatform.iOS) { loginData.MobilePlatform = "iOS"; } else if (Device.OS == TargetPlatform.Android) { loginData.MobilePlatform = "Android"; } else { loginData.MobilePlatform = "Unknown Platform"; } loginData.PhoneIdentifier = DependencyService.Get <IGetDeviceInfo>().GetDeviceInfo(); string ipaddress = DependencyService.Get <IIPAddressManager>().GetIPAddress(); loginData.IPAddress = ipaddress; if (keepLoggedInSwitch.IsToggled) { loginData.CreateAuthToken = true; } GlobalData.SetLoginData(loginData); await Task.Run(() => { _client = new OMGITServiceClient(binding, EndPoint); _client.LoginAsync(loginData); _client.LoginCompleted += ClientOnLoginCompleted; }); try { while (returnMessage.ErrorMessage == null) { continue; } await Task.Run(() => { _client = new OMGITServiceClient(binding, EndPoint); _client.GetNotificationAdminsAsync(loginData); _client.GetNotificationAdminsCompleted += ClientNotificationAdminsCompleted; }); while (NotificationAdmins == null) { continue; } if (returnMessage.Success) { if (keepLoggedInSwitch.IsToggled) { var data = loginData.UserName; var salt = Crypto.CreateSalt(16); var bytes = Crypto.EncryptAes(returnMessage.AuthToken, data, salt); Helpers.Settings.UserName = loginData.UserName; Helpers.Settings.AuthToken = Convert.ToBase64String(bytes); Helpers.Settings.Salt = Convert.ToBase64String(salt); //Application.Current.Properties["LastLoggedInUser"] = loginData.UserName; //Application.Current.Properties[loginData.UserName + "Token"] = bytes; //Application.Current.Properties[loginData.UserName + "Salt"] = salt; //await Application.Current.SavePropertiesAsync(); } OMGITWebServices.OMGInstallationData installData = new OMGITWebServices.OMGInstallationData(); //if (Application.Current.Properties.ContainsKey("DeviceToken")) if (Helpers.Settings.DeviceToken != string.Empty) { //installData.DeviceToken = Application.Current.Properties["DeviceToken"] as string; installData.DeviceToken = Helpers.Settings.DeviceToken; } installData.Username = loginData.UserName; installData.OperatingSystem = loginData.MobilePlatform; await Task.Run(() => { _client = new OMGITServiceClient(binding, EndPoint); _client.RegisterForNotificationsAsync(installData, loginData); _client.RegisterForNotificationsCompleted += ClientOnRegisterCompleted; //_client.RegisterForNotificationsV2Async(installData, loginData); //_client.RegisterForNotificationsV2Completed += ClientOnRegisterCompleted; }); while (registerReturnMessage.ErrorMessage == null) { continue; } bool isAdmin = false; foreach (string s in NotificationAdmins) { if (loginData.UserName == s) { isAdmin = true; break; } } if (isAdmin) { if (alertMessage != "") { Device.BeginInvokeOnMainThread(() => { Navigation.PushModalAsync(new NavigationPage(new AdminMainPage(alertMessage))); }); } else { Device.BeginInvokeOnMainThread(() => { Navigation.PushModalAsync(new NavigationPage(new AdminMainPage())); }); } } else { if (alertMessage != "") { Device.BeginInvokeOnMainThread(() => { Navigation.PushModalAsync(new NavigationPage(new UserNotificationSettingsPage())); }); } else { Device.BeginInvokeOnMainThread(() => { Navigation.PushModalAsync(new NavigationPage(new UserNotificationSettingsPage())); }); } } } else { if (incorrectPasswords == 0) { Label errorMessage = new Label { Text = returnMessage.ErrorMessage, TextColor = Color.Red, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White }; loginForm.Children.Add(errorMessage); } returnMessage.ErrorMessage = null; incorrectPasswords += 1; submit.IsEnabled = true; } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }
public LocationNotificationSendPage() { Title = "Notify"; locationLabel.Text = "Location to Send to:"; try { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Setting title", 0, GlobalData.loginData); LocationPicker.Title = "Select Location to Send to:"; //System.Collections.Generic.SortedDictionary<int,string> validLocations = (SortedDictionary<int,string>) _client.GetValidSendLocationsCompleted += ClientSendLocationsCompleted; _client.GetValidSendLocationsAsync(GlobalData.loginData); while (ValidLocations.Count < 1) { Task.Delay(100).Wait(); } //_client.AddLogMessageTickerAppAsync("In Location Notification Send Page", "Done getting valid locations"); //foreach (KeyValuePair<int, string> entry in validLocations) //{ // LocationPicker.Items.Add(entry.Value); //} foreach (KeyValuePair <int, string> entry in ValidLocations) { StackLayout ClinicLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill }; 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); } _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Items added to Location Picker", 0, GlobalData.loginData); sendNotificationPush.Clicked += SendNotification_Clicked; Logout.Clicked += Logout_Clicked; adminLayout.Children.Add(Logout); adminLayout.Children.Add(SubjectMessage); adminLayout.Children.Add(NotificationMessage); adminLayout.Children.Add(locationLabel); adminLayout.Children.Add(AllClinicsLayout); //adminLayout.Children.Add(LocationPicker); adminLayout.Children.Add(sendNotificationPush); ScrollView adminView = new ScrollView { BackgroundColor = Color.Black, Content = adminLayout }; Content = adminView; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); _client.AddLogMessageMobileAsync("In Location Notification Send Page", "Done creating page", 0, GlobalData.loginData); } catch (Exception ex) { _client.AddLogMessageMobileAsync("In Location Notification Send Page. Error: ", ex.Message.ToString(), 0, GlobalData.loginData); } }
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); } }
public UserNotificationHistoryPage(string username) { try { _client = new OMGITServiceClient(binding, EndPoint); _client.AddLogMessageMobileAsync("In User Notification History Page", "", 0, GlobalData.loginData); HistoryGrid.RowDefinitions.Add(new RowDefinition { Height = 25 }); int i = 1; while (i <= PageSize + 1) { HistoryGrid.RowDefinitions.Add(new RowDefinition { Height = 35 }); i += 1; } HistoryGrid.RowDefinitions.Add(new RowDefinition { Height = 35 }); HistoryGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); HistoryGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); HistoryGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); HistoryGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); HistoryGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); HistoryGrid.Children.Add(SenderLabel, 0, 0); HistoryGrid.Children.Add(SentToLabel, 1, 0); HistoryGrid.Children.Add(EmailLabel, 2, 4, 0, 1); HistoryGrid.Children.Add(TimeLabel, 4, 0); _client.Report_GetUserNotificationHistoryCompleted += ClientReport_GetUserNotificationHistoryCompleted; _client.Report_GetUserNotificationHistoryAsync(username, GlobalData.loginData); while (UserHistory.Count < 1) { continue; } NumPages += UserHistory.Count / PageSize; i = 1; int remainder = UserHistory.Count % PageSize; while (i < NumPages) { System.Collections.Generic.Dictionary <int, OMGITWebServices.OMGUserNotificationHistoryRow> temp = UserHistory.Skip((i - 1) * PageSize).Take(PageSize).ToDictionary(x => x.Key, x => x.Value); UserHistoryList.Add(temp); i += 1; } System.Collections.Generic.Dictionary <int, OMGITWebServices.OMGUserNotificationHistoryRow> lastPage = UserHistory.Skip((i - 1) * PageSize).Take(remainder).ToDictionary(x => x.Key, x => x.Value); UserHistoryList.Add(lastPage); i = 1; foreach (KeyValuePair <int, OMGITWebServices.OMGUserNotificationHistoryRow> kvp in UserHistoryList[0]) { var SenderName = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), Text = kvp.Value.SenderUserName, TextColor = Color.White, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill }; var SentToName = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), Text = kvp.Value.SentToUserName, TextColor = Color.White, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Fill }; var EmailAddress = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, Text = kvp.Value.EmailAddress }; var SentTime = new Label { HorizontalTextAlignment = TextAlignment.Start, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, Text = kvp.Value.SendTime }; HistoryGrid.Children.Add(SenderName, 0, i); HistoryGrid.Children.Add(SentToName, 1, i); HistoryGrid.Children.Add(EmailAddress, 2, 4, i, i + 1); HistoryGrid.Children.Add(SentTime, 4, i); i += 1; } var FirstPageButton = new Button(); var PrevPageButton = new Button(); var CurPageButton = new Button(); var NextPageButton = new Button(); var LastPageButton = new Button(); if (Device.OS == TargetPlatform.Android) { FirstPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "<<", IsEnabled = false }; PrevPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "< Prev", IsEnabled = false }; CurPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = CurrentPage.ToString() + "/" + NumPages.ToString() }; if (NumPages == 1) { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "Next >", IsEnabled = false }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = ">>", IsEnabled = false }; } else { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = "Next >" }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.FromHex("14986D"), VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.White, Text = ">>" }; } } else { FirstPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "<<", IsEnabled = false }; PrevPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "< Prev", IsEnabled = false }; CurPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = CurrentPage.ToString() + "/" + NumPages.ToString() }; if (NumPages == 1) { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "Next >", IsEnabled = false }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = ">>", IsEnabled = false }; } else { NextPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = "Next >" }; LastPageButton = new Button { FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Button)), BackgroundColor = Color.White, VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill, TextColor = Color.Black, Text = ">>" }; } } FirstPageButton.Clicked += FirstPageButton_Clicked; PrevPageButton.Clicked += PrevPageButton_Clicked; NextPageButton.Clicked += NextPageButton_Clicked; LastPageButton.Clicked += LastPageButton_Clicked; HistoryGrid.Children.Add(FirstPageButton, 0, PageSize + 2); HistoryGrid.Children.Add(PrevPageButton, 1, PageSize + 2); HistoryGrid.Children.Add(CurPageButton, 2, PageSize + 2); HistoryGrid.Children.Add(NextPageButton, 3, PageSize + 2); HistoryGrid.Children.Add(LastPageButton, 4, PageSize + 2); Logout.Clicked += Logout_Clicked; HistoryLayout.Children.Add(Logout); HistoryLayout.Children.Add(HistoryGrid); HistoryScrollView.Content = HistoryLayout; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); Content = HistoryScrollView; } catch (Exception ex) { string msg = ex.Message.ToString(); } }