public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			try{
				lblTienda.Text = storeName;
				ProductsPriceInStoreService productsPriceInStoreService = new ProductsPriceInStoreService ();
				productsPriceInStoreService.setListAndStore (this.listId, this.storeId);
				List<ProductsPriceInStoreService> tableItems = productsPriceInStoreService.All ();
				tblProductos.TableHeaderView = this.headerView;

				productImages.Clear();
				foreach (var v in tableItems){
					Images image = new Images{ imageUrl = v.imagen};
					this.productImages.Add(image);
				}
					
				if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
					this.tblProductos.Source = new ProductsTableSourceIphone (tableItems, this);
				}else{
					this.tblProductos.Source = new ProductsTableSource (tableItems, this);
				}

			}catch(System.Net.WebException ex){
				Console.WriteLine ("EXCEPCION WEB: " + ex.ToString());
				UIAlertView alerta = new UIAlertView () { 
					Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
				};
				alerta.AddButton ("Aceptar");
				alerta.Show ();
			}catch(Exception ex){
				Console.WriteLine ("EXCEPCION: " + ex.ToString());
				UIAlertView alerta = new UIAlertView () { 
					Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
				};
				alerta.AddButton ("Aceptar");
				alerta.Show ();
			}
		}
Ejemplo n.º 2
0
			async void BeginDownloadingImage (Images image, NSIndexPath path, String imageUrl)
			{
				// Queue the image to be downloaded. This task will execute
				// as soon as the existing ones have finished.
				byte[] data = null;

				data = await GetImageData (imageUrl);
				if (data == null) {
					image.storeImage = MaxResizeImage(Images.sinImagen, 60,60);
				} else {
					image.storeImage = MaxResizeImage(UIImage.LoadFromData (NSData.FromArray (data)), 60,60);
				}

				InvokeOnMainThread (() => {
					var cell = controller.tblCompare.VisibleCells.Where (c => c.Tag == controller.storeImages.IndexOf (image)).FirstOrDefault ();
					if (cell != null)
						cell.ImageView.Image = image.storeImage;
				});
			}
Ejemplo n.º 3
0
			public void buttonEvent(CGPoint buttonPosition){
				NSIndexPath indexPath = controller.tblProducts.IndexPathForRowAtPoint (buttonPosition);
				UIAlertView alert = new UIAlertView () { 
					Title = "Borrar?", Message = "Deseas borrar este producto?"
				};
				alert.AddButton ("Aceptar");
				alert.AddButton ("Cancelar");
				alert.Clicked += (s, o) => {
					try{
						if(o.ButtonIndex == 0){
							DestroyService destroyService = new DestroyService ();
							String respuesta = destroyService.destroyProductInList(tableItems[indexPath.Row].id,tableItems[indexPath.Row].list_id);
							if (respuesta.Equals ("\"correct\"")) {
								UIAlertView alert1 = new UIAlertView () { 
									Title = "Producto borrado", Message = "El producto ha sido borrado =)"
								};
								alert1.AddButton("Aceptar");
								alert1.Show ();
								ProductsInListService ls = new ProductsInListService();
								ls.setListId(ProductsInListView.list_id);
								List<ProductsInListService> productos = ls.All();
								ProductsInListView.tableView.Source = new ProductsTableSourceIphone(productos,this.controller);
								controller.productImages.Clear();
								foreach (var v in this.tableItems){
									Images image = new Images{ imageUrl = v.imagen};
									controller.productImages.Add(image);
								}
								ProductsInListView.tableView.ReloadData ();
							}else if(respuesta.Equals("\"error\"")){
								UIAlertView alert2 = new UIAlertView () { 
									Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo"
								};
								alert2.AddButton("Aceptar");
								alert2.Show ();
							}
						}
					}catch(System.Net.WebException){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
						};
						alerta.AddButton("Aceptar");
						alerta.Show();
					}catch(Exception ex){
						Console.WriteLine(ex.ToString());
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal, por favor intentalo de nuevo."
						};
						alerta.AddButton("Aceptar");
						alerta.Show();
					}
				};
				alert.Show ();
			}
Ejemplo n.º 4
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			try{

				UIBarButtonItem home = new UIBarButtonItem();
				home.Style = UIBarButtonItemStyle.Plain;
				home.Target = this;
				home.Image = UIImage.FromFile("Images/home.png");
				this.NavigationItem.RightBarButtonItem = home;
				UIViewController[] vistas = NavigationController.ViewControllers;
				home.Clicked += (sender, e) => NavigationController.PopToViewController (vistas [0], true);

				ProductsInListView.tableView = this.tblProducts;
				//Configuramos la vista popup de cantidad
				amountView.Layer.BorderWidth = 1.0f;
				amountView.Layer.BorderColor = UIColor.Black.CGColor;
				amountView.Layer.CornerRadius = 8;

				//Configuramos la vista popup de comparacion de listas
				CompareView.Layer.BorderWidth = 1.0f;
				CompareView.Layer.BorderColor = UIColor.Black.CGColor;
				CompareView.Layer.CornerRadius = 8;

				tblProducts.Add (amountView);
				this.amountView.Hidden = true;
				tblProducts.Add (CompareView);
				this.CompareView.Hidden = true;

				pls.setListId (ProductsInListView.list_id);
				tableItems = pls.All ();

				this.productImages.Clear();
				foreach (var v in tableItems){
					Images image = new Images{ imageUrl = v.imagen};
					this.productImages.Add(image);
				}

				if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
					tblProducts.TableHeaderView = this.FooterView;
					this.tblProducts.Source = new ProductsTableSourceIphone (tableItems, this);
				}else{
					this.tblProducts.Source = new ProductsTableSource (tableItems, this);
				}
				Add (tblProducts);

				this.btnComparar.TouchUpInside += (sender, e) => {
					try{
						if(tableItems.Count > 0){
							compareListService = new CompareListsService();
							compareListService.setListId(ProductsInListView.list_id);
							List<CompareListsService> tableItems2 = compareListService.All();
							if(tableItems2.Count > 0){
								storeImages.Clear();
								foreach (var v in tableItems2){
									Images image = new Images{ storeImageUrl = v.imagen};
									this.storeImages.Add(image);
								}
								if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
									this.tblCompare.Source = new CompareTableSourceIphone(tableItems2,this);
								}else{
									this.tblCompare.Source = new CompareTableSource(tableItems2,this);
								}
								tblCompare.TableHeaderView = this.headerView;
								CompareView.Add(tblCompare);
								this.tblCompare.ReloadData();
								CompareView.Hidden = false;
							}else{
								UIAlertView alerta = new UIAlertView () { 
									Title = "Lo sentimos =(", Message = "Los productos de tu lista no se encuentran en su totalidad en ninguna de nuestras tiendas."
								};
								alerta.AddButton ("Aceptar");
								alerta.Show ();
							}
						}else{
							UIAlertView alerta = new UIAlertView () { 
								Title = "Espera!", Message = "No tienes productos en esta lista, agrega productos para que puedas comparar entre tiendas =)"
							};
							alerta.AddButton ("Aceptar");
							alerta.Show ();
						}
					}catch(WebException){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}catch(Exception){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}
				};

				this.btnCompararUno.TouchUpInside += (sender, e) => {
					try{
						if(tableItems.Count > 0){
							compareListService = new CompareListsService();
							compareListService.setUnoListId(ProductsInListView.list_id);
							List<CompareListsService> tableItems2 = compareListService.All();
							if(tableItems2.Count > 0){
								storeImages.Clear();
								foreach (var v in tableItems2){
									Images image = new Images{ storeImageUrl = v.imagen};
									this.storeImages.Add(image);
								}
								if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
									this.tblCompare.Source = new CompareTableSourceIphone(tableItems2,this);
								}else{
									this.tblCompare.Source = new CompareTableSource(tableItems2,this);
								}
								tblCompare.TableHeaderView = this.headerView;
								CompareView.Add(tblCompare);
								this.tblCompare.ReloadData();
								CompareView.Hidden = false;
							}else{
								UIAlertView alerta = new UIAlertView () { 
									Title = "Lo sentimos =(", Message = "Los productos de tu lista no se encuentran en su totalidad en ninguna de nuestras tiendas."
								};
								alerta.AddButton ("Aceptar");
								alerta.Show ();
							}
						}else{
							UIAlertView alerta = new UIAlertView () { 
								Title = "Espera!", Message = "No tienes productos en esta lista, agrega productos para que puedas comparar entre tiendas =)"
							};
							alerta.AddButton ("Aceptar");
							alerta.Show ();
						}
					}catch(System.Net.WebException){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}catch(Exception){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}
				};

				this.btnCerrar.TouchUpInside += (sender, e) => {
					CompareView.Hidden = true;
				};

				this.btnScan.TouchUpInside += (sender, e) => {
					picker = new ScanditSDKRotatingBarcodePicker (MainView.appKey);
					picker.OverlayController.Delegate = new pickerControllerDelegate(picker, this);
					picker.OverlayController.ShowToolBar(true);
					picker.OverlayController.SetToolBarButtonCaption("Cancelar");
					picker.OverlayController.SetCameraSwitchVisibility(SICameraSwitchVisibility.OnTablet);
					picker.OverlayController.SetTextForInitializingCamera("Iniciando la camara");
					this.NavigationController.PushViewController(picker,true);

					picker.StartScanning ();

				};

				this.btnAceptar.TouchUpInside += (sender, e) => {
					try{
						AddProductFromBarcode apfb = new AddProductFromBarcode ();
						String respuesta = apfb.SetData ( ProductsInListView.barcode, ProductsInListView.list_id, cmpAmount.Text);
						Console.WriteLine (respuesta);
						if (respuesta.Equals ("\"El producto ya existe en esta lista\"")) {
							UIAlertView alert = new UIAlertView () { 
								Title = "Ups :S", Message = "Este producto ya se encuentra registrado en tu lista"
							};
							alert.AddButton ("Aceptar");
							alert.Show ();
						} else if (respuesta.Equals ("\"El producto no existe\"")) {
							UIAlertView alert = new UIAlertView () { 
								Title = "Ups :S", Message = "Este producto no esta registrado en fixbuy =("
							};
							alert.AddButton ("Aceptar");
							alert.Show ();
						} else {
							UIAlertView alert = new UIAlertView () { 
								Title = "Producto Agregado", Message = "El producto ha sido agregado a tu lista =D"
							};
							alert.AddButton("Aceptar");
							alert.Show ();
							pls.setListId (ProductsInListView.list_id);
							tableItems = pls.All ();
							if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
								this.tblProducts.Source = new ProductsTableSourceIphone (tableItems, this);
							}else{
								this.tblProducts.Source = new ProductsTableSource (tableItems, this);
							}
							tblProducts.ReloadData ();
							this.amountView.Hidden = true;
							pickerControllerDelegate.scanned = false;
						}
					}catch(System.Net.WebException){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}catch(Exception){
						UIAlertView alerta = new UIAlertView () { 
							Title = "Ups :S", Message = "Algo salio mal, por favor intentalo de nuevo."
						};
						alerta.AddButton ("Aceptar");
						alerta.Show ();
					}
				};

				this.btnCancelar.TouchUpInside += (sender, e) => {
					this.amountView.Hidden = true;
					pickerControllerDelegate.scanned = false;
				};

				int cantidad = 1;
				this.cmpAmount.Text = cantidad.ToString ();
				btnMas.TouchUpInside += (sender, e) => {
					cantidad ++;
					this.cmpAmount.Text = cantidad.ToString();
				};

				btnMenos.TouchUpInside += (sender, e) => {
					cantidad --;
					if(cantidad < 1){
						UIAlertView alert = new UIAlertView () { 
							Title = "Espera!", Message = "La cantidad minima es 1"
						};
						alert.AddButton("Aceptar");
						alert.Show();
						cantidad = 1;
						this.cmpAmount.Text = cantidad.ToString();
					}else{
						this.cmpAmount.Text = cantidad.ToString();
					}
				};
			}catch(System.Net.WebException){
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
				};
				alert.AddButton("Aceptar");
				alert.Show();
			}catch(Exception ex){
				Console.WriteLine (ex.ToString ());
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =S", Message = "Algo salio mal, por favor intentalo de nuevo."
				};
				alert.AddButton("Aceptar");
				alert.Show();
			}
		}
Ejemplo n.º 5
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.
			try{
				//Configuramos la vista popup de cantidad
				AmountView.Layer.BorderWidth = 1.0f;
				AmountView.Layer.BorderColor = UIColor.Black.CGColor;
				AmountView.Layer.CornerRadius = 8;
				tblProducts.Add(AmountView);
				AmountView.Hidden = true;
				NameSearchResultView.amount = AmountView;

				//Configuramos la vista de popup de listas
				ListsView.Layer.BorderWidth = 1.0f;
				ListsView.Layer.BorderColor = UIColor.Black.CGColor;
				ListsView.Layer.CornerRadius = 8;
				tblProducts.Add(this.ListsView);
				ListsView.Hidden = true;

				//Configuramos la vista popup de nueva lista
				newListView.Layer.BorderWidth = 1.0f;
				newListView.Layer.BorderColor = UIColor.Black.CGColor;
				newListView.Layer.CornerRadius = 8;
				tblProducts.Add(newListView);
				newListView.Hidden = true;

				ps.setProductSearchString (this.nombre);
				List<ProductSearchService> tableItems = ps.All ();

				this.productImages.Clear();
				foreach (var v in tableItems){
					Images image = new Images{ imageUrl = v.imagen};
					this.productImages.Add(image);
				}

				if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone){
					this.tblProducts.Source = new ProductsTableSourceIphone(tableItems, this, MainView.userId);
				}else {
					this.tblProducts.Source = new ProductsTableSource(tableItems, this, MainView.userId);
				}
				this.lblSearch.Text = "Resultados para \"" + nombre +"\"";
				this.tblProducts.TableHeaderView = this.headerView;
				Add (this.tblProducts);
				if (tableItems.Count == 0) {
					UIAlertView alert = new UIAlertView () { 
						Title = "Lo sentimos =(", Message = "La búsqueda de "+ "\""+nombre+"\""+"\n No produjo ningun resultado."
					};
					alert.AddButton("Aceptar");
					alert.Clicked += (sender, e) => {
						NavigationController.PopViewController(true);
					};
					alert.Show ();
				}

				this.btnAceptar.TouchUpInside += (sender, e) => {
					try{
						AmountView.Hidden = true;
						ListsService ls = new ListsService();
						ls.setUserId(MainView.userId.ToString());
						List<ListsService> listItems = ls.All();
						if(listItems.Count > 0){
							this.tblLists.Source = new AddToListsTableSource(listItems,this,NameSearchResultView.product_id,int.Parse(cmpAmount.Text));
							ListsView.Add(tblLists);
							this.tblLists.ReloadData();
							ListsView.Hidden = false;
						}else{
							UIAlertView alert = new UIAlertView () { 
								Title = "No tienes listas", Message = "No tienes listas registradas, porfavor ve a \"Mis listas\" para crear una nueva"
							};
							alert.AddButton("Aceptar");
							alert.Show ();
						}
					}catch(System.Net.WebException){
						UIAlertView alert = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal,no se pudieron cargar tus listas, verifica tu conexión a internet e intentalo de nuevo."
						};
						alert.AddButton("Aceptar");
						alert.Show ();
					}catch(Exception){
						UIAlertView alert = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal, por favor intentalo de nuevo."
						};
						alert.AddButton("Aceptar");
						alert.Show ();
					}
				};

				btnCerrar.TouchUpInside += (sender, e) => {
					this.ListsView.Hidden = true;
				};

				int cantidad = 1;
				this.cmpAmount.Text = cantidad.ToString();
				btnMas.TouchUpInside += (sender, e) => {
					cantidad ++;
					this.cmpAmount.Text = cantidad.ToString();
				};

				btnMenos.TouchUpInside += (sender, e) => {
					cantidad --;
					if(cantidad < 1){
						UIAlertView alert = new UIAlertView () { 
							Title = "Espera!", Message = "La cantidad minima es 1"
						};
						alert.AddButton("Aceptar");
						alert.Show();
						cantidad = 1;
						this.cmpAmount.Text = cantidad.ToString();
					}else{
						this.cmpAmount.Text = cantidad.ToString();
					}
				};

				btnNuevaLista.TouchUpInside += (sender, e) => {
					this.newListView.Hidden = false;
				};

				btnCancelarLista.TouchUpInside += (sender, e) => {
					this.newListView.Hidden = true;
				};

				btnAceptarLista.TouchUpInside += (sender, e) => {
					try{
						if(cmpListName.Text == ""){
							UIAlertView alert = new UIAlertView () { 
								Title = "Espera!", Message = "Debes ingresar el nombre de la lista"
							};
							alert.AddButton("Aceptar");
							alert.Show ();
						}else{
							nls = new NewListService();
							String respuesta = nls.SetListData(cmpListName.Text, MainView.userId.ToString());
							if(respuesta.Equals("\"lista ya existe\"")){
								UIAlertView alert = new UIAlertView () { 
									Title = "Ups :S", Message = "Ese nombre de lista ya se encuentra registrado"
								};
								alert.AddButton("Aceptar");
								alert.Show ();
								cmpListName.Text = "";
							}else{
								UIAlertView alert = new UIAlertView () { 
									Title = "Lista creada", Message = "Tu nueva lista \""+cmpListName.Text+"\" ha sido creada =D"
								};
								alert.AddButton("Aceptar");
								alert.Show ();
								ls = new ListsService();
								ls.setUserId(MainView.userId.ToString());
								List<ListsService> items = ls.All ();
								this.tblLists.Source = new AddToListsTableSource(items,this,NameSearchResultView.product_id,int.Parse(cmpAmount.Text));
								this.tblLists.ReloadData();
								cmpListName.Text = "";
								newListView.Hidden = true;
								cmpListName.ResignFirstResponder();
							}
						}
					}catch(System.Net.WebException){
						UIAlertView alert = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo"
						};
						alert.AddButton("Aceptar");
						alert.Show ();
					}catch(Exception exc){
						Console.WriteLine(exc.ToString());
						UIAlertView alert = new UIAlertView () { 
							Title = "Ups =S", Message = "Algo salio mal, por favor intentalo de nuevo"
						};
						alert.AddButton("Aceptar");
						alert.Show ();
					}
				};

			}catch(WebException){
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =S", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
				};
				alert.AddButton("Aceptar");
				alert.Clicked += (sender, e) => {
					NavigationController.PopViewController(true);
				};
				alert.Show ();
			}catch(Exception){
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =S", Message = "Algo salio mal, por favor intentalo de nuevo."
				};
				alert.AddButton("Aceptar");
				alert.Clicked += (sender, e) => {
					NavigationController.PopViewController(true);
				};
				alert.Show ();
			}
		}
Ejemplo n.º 6
-1
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			try{
				var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
				_pathToDatabase = Path.Combine(documents, "db_sqlite-net.db");

				using (var db = new SQLite.SQLiteConnection(_pathToDatabase ))
				{
					people = new List<Person> (from p in db.Table<Person> () select p);
				}

				//inicializacion del manejador de localizacion.
				iPhoneLocationManager = new CLLocationManager ();
				//Establecer la precision del manejador de localizacion.
				iPhoneLocationManager.DesiredAccuracy = CLLocation.AccuracyNearestTenMeters;

				iPhoneLocationManager.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) => {
					newLocation = e.Locations [e.Locations.Length - 1];
				};
					
				productSearchDetailService.setProductBarcode (this.barcode, MainView.localityId.ToString(), MainView.userId);
				List<ProductSearchDetailService> tableItems = productSearchDetailService.All ();

				this.productImages.Clear();
				foreach (var v in tableItems){
					Images image = new Images{ storeImageUrl = v.imagen};
					this.productImages.Add(image);
				}

				UIBarButtonItem home = new UIBarButtonItem();
				home.Style = UIBarButtonItemStyle.Plain;
				home.Target = this;
				home.Image = UIImage.FromFile("Images/home.png");
				this.NavigationItem.RightBarButtonItem = home;
				UIViewController[] vistas = NavigationController.ViewControllers;
				home.Clicked += (sender, e) => {
					this.NavigationController.PopToViewController(vistas[0], true);
				};

				btnTiendaCercana.TouchUpInside += (sender, e) => {
					try{
						ProductSearchDetailService tiendac= nearestStore(newLocation,tableItems);
						double distancia = newLocation.DistanceFrom(new CLLocation(Double.Parse(tiendac.tienda_latitud),Double.Parse(tiendac.tienda_longitud)))/1000;
						distancia = Math.Round(distancia,2);
						UIAlertView alert = new UIAlertView () { 
							Title = "Tu tienda mas cercana es:", Message = ""+ tiendac.tienda_nombre + "\n "+ tiendac.tienda_direccion+"\n"+"Distancia: " + distancia.ToString() +"km"
						};
						alert.AddButton("Aceptar");
						alert.AddButton("Mapa");
						alert.Clicked += (s , o) => {
							if(o.ButtonIndex == 1){
								SecondMapViewController mapView = new SecondMapViewController();
								mapView.setTienda(tiendac);
								this.NavigationController.PushViewController(mapView, true);
							}
						};
						alert.Show ();
					}catch(NullReferenceException){
						UIAlertView alert = new UIAlertView () { 
							Title = "Lo Sentimos =(", Message = "FixBuy no pudo obtener tu ubicación por favor ve a Ajustes/Privacidad/Localizacion y verifica que Fixbuy tenga permiso de saber tu ubicación"
						};
						alert.AddButton("Aceptar");
						alert.Show();
					}
				};  

				if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
					if (CLLocationManager.LocationServicesEnabled){
						this.tblStores.Source = new StoresTableSourceIphone (tableItems, this, iPhoneLocationManager,people.Count);
					}else{
						this.tblStores.Source = new StoresTableSourceIphone (tableItems, this, null,people.Count);
					}
				} else {
					if (CLLocationManager.LocationServicesEnabled){
						this.tblStores.Source = new StoresTableSource (tableItems, this, iPhoneLocationManager,people.Count);
					}else{
						this.tblStores.Source = new StoresTableSource (tableItems, this, null,people.Count);
					}
				}

				ProductSearchDetailService product = tableItems.ElementAt (0);
				NSUrl nsUrl = new NSUrl (product.imagen);
				NSData data = NSData.FromUrl (nsUrl);
				if(data!=null){
					this.imgProduct.Image = UIImage.LoadFromData (data);
				}else{
					this.imgProduct.Image = Images.sinImagen;
				}
				this.lblproduct.Text = product.nombre;
				this.lblDescription.Text = product.descripcion;
				//this.tblStores.TableHeaderView = this.headerView;
				Add (this.tblStores);

				// Manejamos la actualizacion de la localizacion del dispositivo.
				iPhoneLocationManager.RequestAlwaysAuthorization ();
				if (CLLocationManager.LocationServicesEnabled)
					iPhoneLocationManager.StartUpdatingLocation ();


			}catch(System.ArgumentOutOfRangeException){
				didNotFidProduct();
			}catch(Exception ex){
				Console.WriteLine ("ESTA ES LA EXCEPCION: " + ex.ToString ());
				this.imgProduct.Image = UIImage.FromFile("Images/noImage.jpg");
				this.lblproduct.Text = "Producto no encontrado =S";
				this.lblDescription.Text = "";
				this.btnTiendaCercana.Hidden = true;
				this.tblStores.BackgroundColor = UIColor.Clear;
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =(", Message = "Lo sentimos algo salio mal, por favor intentalo de nuevo"
				};
				alert.AddButton ("Aceptar");
				alert.Show ();
			} 
		}