#Region " Notebook Objects"
<Serializable()> Public Class Notebook
'Inherits NoteSecurity
Private sName, sFileLocation As String
Public AutoNumberStyle As New AutoNumberStyle()
Public Entries As New EntryCollection()
Public NodeCol As New Entry()
Public Property Name() As String
Get
Return sName
End Get
Set(ByVal Value As String)
sName = Value
End Set
End Property
Public Property FileLocation() As String
Get
Return sFileLocation
End Get
Set(ByVal Value As String)
sFileLocation = Value
End Set
End Property
Public Sub Load()
If Me.FileLocation Is Nothing Then
MsgBox("Filelocation not set to load.")
Else
Dim i As Integer
Dim deserializer As New BinaryFormatter()
Dim myFileStream = New IO.FileStream(Me.FileLocation, IO.FileMode.Open) 'File.OpenRead(Me.FileLocation)
Dim tempNote As New Notebook()
Dim ex As Exception
' Try
'Dim note As Object = deserializer.Deserialize(myFileStream)
'tempNote = CType(note, Notebook)
tempNote = deserializer.Deserialize(myFileStream)
' Catch ex
' MsgBox("An error occured while opening this file.", MsgBoxStyle.Critical, "SmarNote Error")
' Exit Sub
'tempNote = CType(deserializer.Deserialize(myFileStream, Nothing), Notebook)
' End Try
myFileStream.Close()
Me.Name = tempNote.Name
Me.FileLocation = tempNote.FileLocation
End If
End Sub
Public Sub Save()
If Me.FileLocation Is Nothing Then
MsgBox("Filelocation not set to save.")
Else
Dim myFileStream As Stream = File.Create(Me.FileLocation)
Dim serializer As New BinaryFormatter()
myFileStream.Seek(0, SeekOrigin.Begin)
serializer.Serialize(myFileStream, Me)
myFileStream.Close()
End If
End Sub
Public Sub New()
End Sub
End Class
<Serializable()> Public Class Entry
Inherits System.Windows.Forms.TreeNode
Private sName As String
Private nn As TreeNode
Public Notes As New Page_Notes_Collection()
Public KeyPoints As New Page_KeyPoints_Collection()
Public ImpactWindows As New Page_ImpactWindow_Collection()
Public Caselaws As New Page_CaseLaw_Collection()
Public Property Name()
Get
Return sName
End Get
Set(ByVal Value)
sName = Value
End Set
End Property
Public Property Node() As TreeNode
Get
Return nn
End Get
Set(ByVal Value As TreeNode)
nn = Value
End Set
End Property
Public Sub New()
End Sub
End Class
<Serializable()> Public Class EntryCollection
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal awidget As Entry)
List.Add(awidget)
End Sub
Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!")
Else
List.RemoveAt(index)
End If
End Sub
Public ReadOnly Property Items(ByVal index As Integer) As Entry
Get
Return CType(List.Item(index), Entry)
End Get
End Property
Public Sub New()
End Sub
End Class
<Serializable()> Public Class Page_CaseLaw_Collection
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal awidget As String)
List.Add(awidget)
End Sub
Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!")
Else
List.RemoveAt(index)
End If
End Sub
Public ReadOnly Property Items(ByVal index As Integer) As String
Get
Return CType(List.Item(index), String)
End Get
End Property
Public Sub New()
End Sub
End Class
<Serializable()> Public Class Page_ImpactWindow_Collection
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal awidget As String)
List.Add(awidget)
End Sub
Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!")
Else
List.RemoveAt(index)
End If
End Sub
Public ReadOnly Property Items(ByVal index As Integer) As String
Get
Return CType(List.Item(index), String)
End Get
End Property
Public Sub New()
End Sub
End Class
<Serializable()> Public Class Page_Notes_Collection
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal awidget As String)
List.Add(awidget)
End Sub
Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!")
Else
List.RemoveAt(index)
End If
End Sub
Public ReadOnly Property Items(ByVal index As Integer) As String
Get
Return CType(List.Item(index), String)
End Get
End Property
Public Sub New()
End Sub
End Class
<Serializable()> Public Class Page_KeyPoints_Collection
Inherits System.Collections.CollectionBase
Public Sub Add(ByVal awidget As String)
List.Add(awidget)
End Sub
Public Sub Remove(ByVal index As Integer)
If index > Count - 1 Or index < 0 Then
System.Windows.Forms.MessageBox.Show("Index not valid!")
Else
List.RemoveAt(index)
End If
End Sub
Public ReadOnly Property Items(ByVal index As Integer) As String
Get
Return CType(List.Item(index), String)
End Get
End Property
Public Sub New()
End Sub
End Class
#End Region