public void funcFavoritos(ImageView fav) { AlertDialog.Builder popupBuilder = new AlertDialog.Builder(context); popupBuilder.SetTitle("Mis Favoritos"); popupBuilder.SetCancelable(false); popupBuilder.SetMessage("Se aƱadio a mis favoritos!"); popupBuilder.SetNeutralButton("Volver", delegate { }); //popupBuilder.Show(); int id = (int)fav.Tag; /*Marcadores prefs = Constants.GetMarkers(Constants.MarkersFileName); * prefs.PutString(Constants.MarkerTitleKey, _listUnidades[id].Title); * prefs.PutString(Constants.MarkerInfoKey,_listUnidades[id].Description); * prefs.PutString(Constants.MarkerIdKey, String.Format("{0}",_listUnidades[id].Id)); * * prefs.Commit();*/ //------------------------Utilizando TodList para la Tabla Favoritos ------------------------------------------------------------------ //------------------------Utilizando TodList para la Tabla Favoritos ------------------------------------------------------------------ //Sacar la lista de Favoritos listFavorites.Clear(); listFavorites = FavoritosItemManager.GetTasks(); //----------------------------- int id_auto = isListFavorites(_listUnidades[id].Id); if (id_auto == -1) { Titulo = _listUnidades[id].Title; Descripcion = _listUnidades[id].Description; Id_Unidad = _listUnidades[id].Id; fav.SetImageBitmap(iconFavorito); SaveFav(); } else { FavoritosItemManager.DeleteTask(id_auto); popupBuilder.SetMessage("Se elimino de Favoritos!"); fav.SetImageBitmap(iconFavorito_BN); } //Dialog------------------------------------------ Dialog dial = popupBuilder.Create(); dial.Show(); new Thread(() => { Thread.Sleep(1000); dial.Dismiss(); }).Start(); //linearContenido.RemoveView (favorit); }
//Trabajar con la BD - Tabla Favoritos void SaveFav() { task.Titulo = Titulo; task.Descripcion = Descripcion; task.Id_unidad = Id_Unidad; task.Unit_Index = Id_Unidad; task.Section_Index = Id_section; FavoritosItemManager.SaveTask(task); }
protected override void OnResume() { base.OnResume(); tasks = FavoritosItemManager.GetTasks(); // create our adapter taskList = new FavoritosItemListAdapter(this, tasks); //Hook up our adapter to our ListView taskListView.Adapter = taskList; taskListView.ItemClick += listView_ItemClick; }
void Initialize() { //Sacar la lista de Favoritos listFavorites = FavoritosItemManager.GetTasks(); //----------------------------- var metrics = Resources.DisplayMetrics; widthInDp = ((int)metrics.WidthPixels); heightInDp = ((int)metrics.HeightPixels); Configuration.setWidthPixel(widthInDp); Configuration.setHeigthPixel(heightInDp); adsImagesPath = AddResources.Instance.addList; //iconMap = Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/iconmap.png"), Configuration.getWidth (60), Configuration.getWidth (80), true); iconPlay = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/playc.png"), Configuration.getWidth(60), Configuration.getWidth(60), true); iconInfo = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/info.png"), Configuration.getWidth(60), Configuration.getWidth(60), true); iconFavorito_BN = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/favoritos_BN.png"), Configuration.getWidth(60), Configuration.getWidth(60), true); iconFavorito = Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/favoritos.png"), Configuration.getWidth(60), Configuration.getWidth(60), true); ini(); this.AddView(_mainLayout); }