Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            txtTitleMain       = FindViewById <TextView>(Resource.Id.txtTitleMain);
            txtIngredientsMain = FindViewById <TextView>(Resource.Id.txtIngredientsMain);

            imgFoodMain = FindViewById <ImageView>(Resource.Id.imgFoodMain);

            btnLikeMain    = FindViewById <Button>(Resource.Id.btnLikeMain);
            btnDislikeMain = FindViewById <Button>(Resource.Id.btnDislikeMain);
            FavouritesMain = FindViewById <Button>(Resource.Id.btnFavouritesMain);

            SearchMain    = FindViewById <EditText>(Resource.Id.txtSearchMain);
            btnSearchMain = FindViewById <Button>(Resource.Id.btnSearchMain);

            food = new RecipesFinder();

            // Click events \\
            btnDislikeMain.Click += BtnDislikeMain_Click;
            btnLikeMain.Click    += BtnLikeMain_Click;
            FavouritesMain.Click += FavouritesMain_Click;
            btnSearchMain.Click  += BtnSearchMain_Click;

            btnLikeMain.Enabled    = false;
            btnDislikeMain.Enabled = false;
        }
Exemplo n.º 2
0
 private void BtnSearchMain_Click(object sender, System.EventArgs e)
 {
     try
     {
         string        FoodSearch = SearchMain.Text;
         RecipesFinder objrest    = new RecipesFinder();
         root = objrest.ExecuteRequest(FoodSearch);
         GetRecipe();
         btnLikeMain.Enabled    = true;
         btnDislikeMain.Enabled = true;
     }
     catch
     {
         Toast.MakeText(this, SearchMain.Text + " No Recipes found. Please try a new search.", ToastLength.Long).Show();
         return;
     }
 }