Example #1
0
        private void Txt_Serach_TextChanged(object sender, TextChangedEventArgs e)
        {
            IBookstore         bookstore = new BookstoreRefService();
            IEnumerable <Book> books;

            if (Txt_Serach.Text.Length == 0)
            {
                books = bookstore.GetBooks();
            }
            else
            {
                string searchOn = "";
                if (Cmb_Search.SelectedIndex == 0)
                {
                    searchOn = "title";
                }
                else
                {
                    searchOn = "author";
                }
                books = bookstore.GetBookAsync(Txt_Serach.Text, searchOn);
            }
            Lst_Books.Items.Clear();
            foreach (var book in books)
            {
                Lst_Books.Items.Add(book);
            }
        }
Example #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            IBookstore         bookstore = new BookstoreRefService();
            IEnumerable <Book> books     = bookstore.GetBooks();

            Lst_Books.Items.Clear();
            foreach (var book in books)
            {
                Lst_Books.Items.Add(book);
            }

            Cmb_Search.Items.Add("Search on Title");
            Cmb_Search.Items.Add("Search on Author");
            Cmb_Search.SelectedIndex = 0;

            Txt_Author.Text  = "";
            Txt_InStock.Text = "0";
            Txt_Price.Text   = "0,0";
            Txt_Title.Text   = "";
        }