示例#1
0
        private async void BookReseravation_Click(Book book)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            string strVR = loader.GetString("ValideReservation");
            string yes = loader.GetString("Yes");
            string no = loader.GetString("No");
            var dialog = new Windows.UI.Popups.MessageDialog(book.Title+"\n" + strVR);      
            dialog.Commands.Add(new Windows.UI.Popups.UICommand(yes) { Id = 1 });
            dialog.Commands.Add(new Windows.UI.Popups.UICommand(no) { Id = 0 });

            var result = await dialog.ShowAsync();

            if ((int)result.Id == 1)
            {
                var duplicate = false;
                foreach (var b in bookReservation)
                {
                    if (b.NumBook == book.NumBook)
                        duplicate = true;
                }
                if(duplicate == false)
                    bookReservation.Add(book);
                else
                {
                    var str = loader.GetString("Duplicate");
                    dialog = new Windows.UI.Popups.MessageDialog(str);
                    await dialog.ShowAsync();
                }
            }
        }
示例#2
0
 public ObservableCollection<Book> fillBook(Book[] booksResponse)
 {
     ObservableCollection<Book> listBooks = new ObservableCollection<Book>();
     foreach (var b in booksResponse)
     {
         Book book = new Book();
         book.Author = b.Author;
         book.Categorie = b.Categorie;
         book.DateEntry = b.DateEntry;
         book.Editor = b.Editor;
         book.NumberReservation = b.NumberReservation;
         book.NumBook = b.NumBook;
         book.Rangement = b.Rangement;
         book.Statut = b.Statut;
         book.Title = b.Title;
         book.YearPublication = b.YearPublication;
         listBooks.Add(book);
     }
     return listBooks;
 }
 private void DeleteBook(Book book)
 {
     BooksReservation.Remove(book);
     bookReservation = BooksReservation.ToList();
 }