public async void FindLocBN_clicked(object sender, EventArgs e) { InitializeLocationManager(); if (isGPSenabled == false) { turnGPSon(); } else { cityButtonPressedIndicGlob = false; cityTextGlobal = null; ipressedGlob = false; if (_currentLocation == null) { _addressTextGlobalVariable = "Can't determine the current address. Try again in a few minutes."; } try { Address address = await ReverseGeocodeCurrentLocation(); DisplayAddress(address); //spliting string with coordinates string[] values = _locationTextGlobalVariable.Split(','); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); if (i == 0) { _x = values[i]; } if (i == 1) { _y = values[i]; } } //Insert Coordinates to DB DB.myDBRepo dbr = new DB.myDBRepo(); dbr.InsertCoordinates(_x, _y); dbr.InsertcityOrCoordIndicator("coord"); StartActivity(new Intent(this, typeof(LoadingActivity))); } catch { Toast.MakeText(this, "Determination failed", ToastLength.Short).Show(); } } }
private void MAIN_Activity_Click(object sender, EventArgs e) { InitializeLocationManager(); firstAppLaunchGlob = false; cityButtonPressedIndicGlob = true; ipressedGlob = true; cityTextGlobal = FindViewById <EditText>(Resource.Id.cityNameET).Text; //Insert city to db DB.myDBRepo dbr = new DB.myDBRepo(); dbr.InsertcityOrCoordIndicator("city"); if (cityTextGlobal == null || cityTextGlobal == "" || cityTextGlobal == " " || cityTextGlobal == " ") { Toast.MakeText(this, "Enter your city name", ToastLength.Long).Show(); } else { StartActivity(new Intent(this, typeof(LoadingActivity))); } }