private void addBook_Click(object sender, EventArgs e)
        {
            Book book = new Book(ISBN.Text, title.Text, author.Text, Convert.ToInt16(year.Text), Convert.ToInt16(pages.Text));

            books.Add(new BookCopy(book));
            this.Close();
        }
Beispiel #2
0
        private void NewCopy(DataGridView sender)
        {
            Book book = books.FindBook(sender.SelectedRows[0].Cells[1].Value.ToString(), sender.SelectedRows[0].Cells[0].Value.ToString());

            if (book != null)
            {
                books.Add(new BookCopy(book));
                MessageBox.Show("New Copy added");
            }
        }
        public static void Deserialize(StreamReader reader, BookDictionary dictionary)
        {
            dictionary.Clear();
            XmlSerializer serializer = new XmlSerializer(typeof(List <Pair>));
            List <Pair>   list       = (List <Pair>)serializer.Deserialize(reader);

            foreach (Pair entry in list)
            {
                dictionary.Add(entry.Value);
            }
        }