Imports System.ComponentModel
Imports System.Collections.ObjectModel
Public Class LibraryBusinessLogic
Public Function GetLibrary() As ObservableCollection(Of Category)
Dim library As New ObservableCollection(Of Category)
Dim c1 As New Category("Thriller")
c1.AddBook("0399152970", "S is for Silence", "Sue Grafton")
c1.AddBook("015601131X", "A Darkening Stain", "Robert Wilson")
c1.AddBook("0446696269", "Honeymoon", "James Patterson")
c1.AddBook("0140231706", "Berlin Noir", "Philip Kerr")
c1.AddBook("0553587889", "Prodigal Son", "Dean Koontz")
c1.AddBook("0743431685", "A Murder of Quality", "John le Carre")
c1.AddBook("0553804790", "The Husband", "Dean Koontz")
c1.AddBook("0743270363", "Consent to Kill: A Thriller", "Vince Flynn")
c1.AddBook("0142004308", "Dissolution", "C. J. Sansom")
c1.AddBook("0385510454", "The Broker", "John Grisham")
library.Add(c1)
Dim c2 As New Category("Biography")
c2.AddBook("0743226712", "1776", "David McCullough")
c2.AddBook("1594200092", "Alexander Hamilton", "Ron Chernow")
c2.AddBook("0375705244", "Founding Brothers: The Revolutionary Generation", "Joseph J. Ellis")
c2.AddBook("0679764410", "American Sphinx: The Character of Thomas Jefferson", "Joseph J. Ellis")
c2.AddBook("0743223136", "John Adams", "David McCullough")
c2.AddBook("0684824906", "Team of Rivals", "Doris Kearns Goodwin")
c2.AddBook("0684807610", "Benjamin Franklin : An American Life", "Walter Isaacson")
c2.AddBook("0385507380", "Andrew Jackson: His Life and Times", "H.W.Brands")
library.Add(c2)
Dim c3 As New Category("Computer")
c3.AddBook("0789728966", "Absolute Beginner's Guide to Computer Basics", "Michael Miller")
c3.AddBook("0764540742", "PCs for Dummies, Ninth Edition", "Dan Gookin")
c3.AddBook("0789730332", "How Computers Work, Seventh Edition", "Ron White and Timothy Edward Downs")
c3.AddBook("0070004846", "Structure and Interpretation of Computer Programs", "Harold Abelson, Gerald Sussman, and Julie Sussman")
c3.AddBook("1418843725", "Discovering Computers: Fundamentals, Second Edition", "Gary B. Shelly, Thomas J. Cashman, and Misty E. Vermaat")
c3.AddBook("0132433109", "Data and Computer Communications (8th Edition)", "William Stallings")
c3.AddBook("1568812698", "Fundamentals of Computer Graphics, Second Ed.", "Peter Shirley, Michael Ashikhmin, Michael Gleicher, and Stephen Marschner")
c3.AddBook("0764134175", "Dictionary of Computer and Internet Terms", "Douglas Downing, Michael Covington, and Melody Mauldin Covington")
c3.AddBook("0131432249", "Computers Brief (12th Edition)", "Larry Long and Nancy Long")
c3.AddBook("0131433512", "Computer Networks and Internets, Fourth Edition", "Douglas E Comer and Ralph E. Droms")
c3.AddBook("013034074X", "Computer Systems: A Programmer's Perspective", "Randal E. Bryant and David R. O'Hallaron")
c3.AddBook("0763741493", "Computer Science Illuminated", "Nell B. Dale")
c3.AddBook("0619213892", "Practical Computer Literacy", "June Jamrich Parsons and Dan Oja")
c3.AddBook("0321247442", "Introduction to Computer Security", "Matt Bishop")
c3.AddBook("0789734206", "Easy Computer Basics (Que's Easy Series)", "Michael Miller")
library.Add(c3)
Return library
End Function
Public Function GetCategory() As カテゴリ
Dim c1 As New Category("Thriller")
c1.AddBook("0399152970", "S is for Silence", "Sue Grafton")
c1.AddBook("015601131X", "A Darkening Stain", "Robert Wilson")
c1.AddBook("0446696269", "Honeymoon", "James Patterson")
c1.AddBook("0140231706", "Berlin Noir", "Philip Kerr")
c1.AddBook("0553587889", "Prodigal Son", "Dean Koontz")
c1.AddBook("0743431685", "A Murder of Quality", "John le Carre")
c1.AddBook("0553804790", "The Husband", "Dean Koontz")
c1.AddBook("0743270363", "Consent to Kill: A Thriller", "Vince Flynn")
c1.AddBook("0142004308", "Dissolution", "C. J. Sansom")
c1.AddBook("0385510454", "The Broker", "John Grisham")
Return c1
End Function
End Class
Public Class カテゴリ
Implements INotifyPropertyChanged
Dim m_name As String
Dim m_books As New ObservableCollection(Of Book)
Public Event PropertyChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.PropertyChangedEventArgs) _
Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Public Sub New(ByVal name As String)
Me.Name = name
End Sub
Public Sub AddBook(ByVal isbn As String, ByVal title As String, ByVal author As String)
Me.Books.Add(New Book(isbn, title, author))
End Sub
Public Property Name() As String
Get
Return m_name
End Get
Set(ByVal value As String)
If m_name <> value Then
m_name = value
NotifyPropertyChanged("Name")
End If
End Set
End Property
Public Property Books() As ObservableCollection(Of Book)
Get
Return m_books
End Get
Set(ByVal value As ObservableCollection(Of Book))
If Not m_books.Equals(value) Then
m_books = value
NotifyPropertyChanged("Books")
End If
End Set
End Property
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
End Sub
End Class
Public Class 本
Implements INotifyPropertyChanged
Public Event PropertyChanged(ByVal sender As Object, _
ByVal e As System.ComponentModel.PropertyChangedEventArgs) _
Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Dim m_isbn As String
Dim m_title As String
Dim m_author As String
Public Sub New(ByVal isdn As String, ByVal title As String, ByVal author As String)
Me.Isbn = isdn
Me.Title = title
Me.Author = author
End Sub
Public Property Isbn() As String
Get
Return m_isbn
End Get
Set(ByVal value As String)
If m_isbn <> value Then
m_isbn = value
NotifyPropertyChanged("Isbn")
End If
End Set
End Property
Public Property Title() As String
Get
Return m_title
End Get
Set(ByVal value As String)
If m_title <> value Then
m_title = value
NotifyPropertyChanged("Title")
End If
End Set
End Property
Public Property Author() As String
Get
Return m_author
End Get
Set(ByVal value As String)
If m_author <> value Then
m_author = value
NotifyPropertyChanged("Author")
End If
End Set
End Property
Private Sub NotifyPropertyChanged(ByVal info As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(info))
End Sub
End Class