Saving Annotation
Posted: Sun Nov 13, 2011 5:42 am
I can add additional parameters to a particular annotation by creating a new class and then inheriting the annotation class - such as RulerAnnotation.
My problem is that I want to save the properties when I save the annotation. I can override the Serialize and Deserialize methods to do this to save in Binary format with no problem. I want to save them in Xml - however, routines in the base class for Xml seem to be marked as not overridable. Can this be changed to use both Serial and Xml save formats?
Public Class MyRulerAnnotation
Inherits RulerAnnotation
Public Property Part As String
''' Not Allowed
'Protected Overrides Sub WriteXmlContent(writer As XmlWriter)
'End Sub
''' Not allowed
'Protected Overrides Sub ReadXmlContent(reader As XmlReader)
'End Sub
Protected Overrides Sub Serialize(writer As System.IO.BinaryWriter)
MyBase.Serialize(writer)
writer.Write(Part)
End Sub
Protected Overrides Sub Deserialize(reader As System.IO.BinaryReader)
MyBase.Deserialize(reader)
Part = reader.ReadString
End Sub
End Class
My problem is that I want to save the properties when I save the annotation. I can override the Serialize and Deserialize methods to do this to save in Binary format with no problem. I want to save them in Xml - however, routines in the base class for Xml seem to be marked as not overridable. Can this be changed to use both Serial and Xml save formats?
Public Class MyRulerAnnotation
Inherits RulerAnnotation
Public Property Part As String
''' Not Allowed
'Protected Overrides Sub WriteXmlContent(writer As XmlWriter)
'End Sub
''' Not allowed
'Protected Overrides Sub ReadXmlContent(reader As XmlReader)
'End Sub
Protected Overrides Sub Serialize(writer As System.IO.BinaryWriter)
MyBase.Serialize(writer)
writer.Write(Part)
End Sub
Protected Overrides Sub Deserialize(reader As System.IO.BinaryReader)
MyBase.Deserialize(reader)
Part = reader.ReadString
End Sub
End Class