Esempio n. 1
0
        private async void btnBuscar_Click(object sender, EventArgs e)
        {
            if (btnBuscar.Enabled)
            {
                statusButtonBuscar(false);
                string             search   = txtPesquisa.Text;
                PesquisaController pesquisa = new PesquisaController();
                changeStatusSearchPanel(true);
                ItemsBook books = await pesquisa.getBooks(search, startIndex : page);

                List <string> bookIds = Favorite.getAllId().ToList();
                if (books.items != null && books.items.Count() > 0)
                {
                    foreach (var book in books.items)
                    {
                        if (bookIds.Any <string>(bk => bk.Equals(book.id)))
                        {
                            book.Favorite = true;
                        }
                        UcCardBook card = new UcCardBook(book);
                        card.Name = "book" + book.id;

                        fpnlBooks.Controls.Add(card);
                    }
                    pnlFundo.Refresh();
                }
                totalItems = books.totalItems;
                setStatusButtons();
                setButtonVisibility(true);
                changeStatusSearchPanel(false);
                statusButtonBuscar(true);
            }
        }
Esempio n. 2
0
 private void btnFavorite_Click(object sender, EventArgs e)
 {
     Favorite.delete(favorite.id);
     UcFavoritos.flowPanel.Controls.Remove(UcFavoritos.flowPanel.Controls.Find("card" + favorite.id, true).FirstOrDefault());
     UcFavoritos.flowPanel.Refresh();
     if (UcPesquisa.flowPanel != null)
     {
         UcCardBook fav = (UcCardBook)UcPesquisa.flowPanel.Controls.Find("book" + favorite.id, false).FirstOrDefault();
         fav.changeFavorite(false);
         fav.changeBtnImg();
         fav.Refresh();
     }
 }