Exemple #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);
            }
        }
 public PesquisaControllerTest()
 {
     _service    = new Mock <IPesquisaService>();
     _controller = new PesquisaController(_service.Object);
 }