void OnItemSelected (object sender, XLabs.GridEventArgs<object> e)
		{
			var item = e.Value as MediaItem;
			DisplayAlert ("you selected an item", item.Name, "Ok");
		}
Esempio n. 2
0
		void UpdatePosition(XLabs.Platform.Services.Geolocation.Position result)
		{


			//  Show on map - needs code made to work

			try
			{
				var position = new Xamarin.Forms.Maps.Position(result.Latitude, result.Longitude);

				Device.BeginInvokeOnMainThread( () =>
					{
						try
						{
							IsBusy = false;
							//                                                if (result.IsFaulted)
							//                                                {
							//                                                    PositionStatus = ((GeolocationException)t.Exception.InnerException).Error.ToString();
							//                                                }
							//                                                else if (t.IsCanceled)
							//                                                {
							//                                                    PositionStatus = "Canceled";
							//                                                }
							//else
							{
								position = new Xamarin.Forms.Maps.Position (position.Latitude + .01*counter++, position.Longitude);
								_map.MoveToRegion(MapSpan.FromCenterAndRadius(position, Distance.FromMiles(1)));
								var pin = new Pin
								{
									Type = PinType.Place,
									Position = position,
									Label = "Current Location"
								};
								_map.Pins.Add(pin);
							}
						}
						catch (Exception e)
						{
							if (DEBUG) {
								var notificator = DependencyService.Get<IToastNotificator> ();
								var tapped = notificator.Notify (ToastNotificationType.Info, 
									"GeoLocator", "GetPositionAsyncContinueWithError: "+e.InnerException.ToString(), TimeSpan.FromSeconds (3)); 
							}
						}
					});
			}
			catch (Exception e) {
				if (DEBUG) {
					var notificator = DependencyService.Get<IToastNotificator> ();
					var tapped = notificator.Notify (ToastNotificationType.Info, 
						"GeoLocator", "GetPositionAsyncContinueWithError: "+e.InnerException.ToString(), TimeSpan.FromSeconds (3)); 
				}                
			}

		}
Esempio n. 3
0
 //If Signing up for Volunteer checkbox is checked, usertype wants to be volunteer, else basic user.
 //The usertype variable is used to send it to the server for admin
 private void IsVolunteer_CheckedChanged(object sender, XLabs.EventArgs<bool> e)
 {
     System.Diagnostics.Debug.WriteLine(e.Value);
     if(e.Value == true)
     {
         usertype = "Volunteer";
        
     }
     else
     {
         usertype = "Basic";
     };
 }
		async private void getEixos(object sender, XLabs.EventArgs<XLabs.Vector3> e){
			var x = e.Value.X;
			var y = e.Value.Y;
			var z = e.Value.Z;

			gForce = Math.Sqrt ((x * x) + (y * y) + (z * z));

			if (gForce > 2 && gForce <= 5) {

				var service = new BumpService ();

				var position = await this.geolocator.GetPositionAsync (timeout: 10000);

				await service.AddAsync(position.Latitude, position.Longitude, (int)gForce);

				var list = await service.ListAsync ();

				foreach (var pino in list) {
					SetPinOnMap (pino.Latitude, pino.Longitude, pino.Severity);
				} 


			}

			Debug.WriteLine ("Forca G: " + gForce);

		}
		void OnItemSelected (object sender, XLabs.GridEventArgs<object> e)
		{
			var item = e.Value as MediaItem;
			this.ParentView.GetParentPage ().DisplayAlert ("you selected an item", item.Name, "Ok");
		}
 private void OnNavigating(object sender, XLabs.EventArgs<Uri> e)
 {
     //this.InjectNativeFunctionScript();
 }
 void OnCellGesture(object sender, XLabs.Forms.Behaviors.GestureResult e)
 {
     //UserDialogs.Instance.Toast (e.GestureType.ToString ());
 }