static void Main(string[] args)
        {
            Library library = new Library();
            StudentFantast stFantast = new StudentFantast();
            StudentComputerScientist stCompScientist = new StudentComputerScientist();

            library.registerStudent(stFantast);
            library.registerStudent(stCompScientist);

            library.AddBook(new Book("The Lord of the rings", "Peter Jackson", "fantasy"));
            library.AddBook(new Book("Modern operating systems", "Andrew Tanenbaum", "computer science"));
            library.AddBook(new Book("Triumphal arch", "Erich Maria Remarque", "war novel"));

            Book book1 = new Book("The computer science", "The author", "computer science");
            library.AddBook(book1);

            try
            {
                library.TakeBook(book1);
            }
            catch (ArgumentException)
            {

            }

            foreach (Book book in library)
            {
                Console.WriteLine(book.BookName);
            }

            Console.ReadKey();
        }
Пример #2
0
 public void NewBookComputerLiterature(Book book)
 {
     if (book.Genre == "ComputerLiterature")
     {        
         Console.WriteLine("В библиотеку пришла комп.литер.Первый студент отправился за Комп.Литертурой");
     }
 }
Пример #3
0
 public void RemoveBook(Book book)
 {
     _books.Remove(book);
     removeBook(book);
     NotifyCollectionChangedEventArgs Args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, book);
     CollectionChanged(this, Args);
 }
Пример #4
0
 public void NewBookFantastik(Book book)
 {
     if (book.Genre == "Fantastic")
     {     
         Console.WriteLine("В библиотеку пришла фант. литер.Второй студент отправился за Комп.Литертурой");
     }
 }
Пример #5
0
 public void AddBook(Book book)
 {
     _library.Add(book);
     if (BookAdded != null)
     {
         BookAdded(this, new BookChangeEventArgs(book));
     }
 }
Пример #6
0
        public void AddBook(Book book)
        {
            _books.Add(book);
            addBook(book);

            NotifyCollectionChangedEventArgs Args = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add,book);
            CollectionChanged(this,Args);

        }
Пример #7
0
        public void RemovedBookFromLibrary(Book book)
        {

            if (book.Genre != "Fantastic")
            {
                Console.WriteLine("Я не собирался идти за этой книгой");

            }
        }
Пример #8
0
        public void NewBookFantastik(Book book)
        {
            if (book.Genre == "Fantastic")
            {
                Console.WriteLine("LIBRARY HAVE NEW Fantastik");

            }

        }
        public Book TakeBook(Book book)
        {
            if (!_library.Contains(book))
            {
                throw new ArgumentException("There is no book with such name in the library");
            }

            _library.Remove(book);
            return book;
        }
Пример #10
0
        public void NewBookComputerLiterature(Book book)
        {

            if (book.Genre == "ComputerLiterature")
            {
                Console.WriteLine("LIBRARY HAVE NEW ComputerLiterature");

            }

        }
Пример #11
0
        public void AddBook(Book book)
        {
            if(book == null)
            {
                throw new ArgumentNullException();
            }
            else
            {
                _books.Add(book);

                OnBookAdded(new LibEventArgs(book.Title, book.Genre));
            }
        }
Пример #12
0
        public Book TakeBook(Book book)
        {
            if (!_library.Contains(book))
            {
                throw new ArgumentException("There is no book with such name in the library");
            }

            if (BookAdded != null)
            {
                BookTaken(this, new BookChangeEventArgs(book));
                _library.Remove(book);
            }

            return book;
        }
Пример #13
0
 public void RemoveBook(Book book)
 {
     lst.Remove(book);
     removeBook(book);
 }
Пример #14
0
        public void AddBook(Book book)
        {
            lst.Add(book);
            addBook(book);

        }
 public void AddBook(Book book)
 {
     _library.Add(book);
 }
Пример #16
0
 public BookChangeEventArgs(Book book)
 {
     _book = book;
 }