|
Group: Forum Members
Posts: 7,
Visits: 1
|
This is my class and still not saving and give this message "Failed to save to file. Exception was: There was an error generating the XML document." so please if you have a sample or if you can help me where is the error ----------------------------------------------
Imports System.Drawing Imports System.ComponentModel Imports System.Drawing.Design Imports System.Collections.Generic Imports Nevron.UI Imports Nevron.UI.WinForm.Controls Imports System.Reflection Imports Nevron.Chart.WinForm Imports Nevron.Diagram Imports Nevron.Diagram.Shapes Imports Nevron.GraphicsCore Imports System.Xml Imports System.Xml.Schema Imports System.Xml.Serialization ("CreateCustomPropertiesSchema")> _ Public Class CustomProperties Implements IXmlSerializable, ICloneable
#Region "Constructions ..." Public Sub New()
End Sub Public Sub New(ByVal strShapeName As String, ByVal strType As String, ByVal iWeight As Integer, ByVal strPhysics As String, ByVal iShapeImage As Integer, ByVal strDesc As String) _ShapeName = strShapeName _ShapeType = strType _Weight = iWeight _Physics = strPhysics _ShapeImage = iShapeImage _Decription = strDesc End Sub
Public Shared Function CreateCustomPropertiesSchema(ByVal schemaSet As XmlSchemaSet) As XmlQualifiedName Dim schema As XmlSchema = New XmlSchema()
Return "" End Function
#End Region
#Region " properties ..."
Dim _Shapeid As Integer = 0 Public Property Shapeid() As Integer Get Return _Shapeid End Get Set(ByVal value As Integer) _Shapeid = value End Set End Property Dim _ShapeName As String = "" Public Property ShapeName() As String Get Return _ShapeName End Get Set(ByVal value As String) _ShapeName = value End Set End Property
Dim _ShapeType As String = "" Public Property ShapeType() As String Get Return _ShapeType End Get Set(ByVal value As String) _ShapeType = value End Set End Property
Dim _Weight As Integer = 0 Public Property Weight() As Integer Get Return _Weight End Get Set(ByVal value As Integer) _Weight = value End Set End Property
Dim _Physics As String = "" Public Property Physics() As String Get Return _Physics End Get Set(ByVal value As String) _Physics = value End Set End Property
Dim _ShapeImage As String = "" Public Property ShapeImage() As String Get Return _ShapeImage End Get Set(ByVal value As String) _ShapeImage = value End Set End Property Dim _Decription As String = "" Public Property Decription() As String Get Return _Decription End Get Set(ByVal value As String) _Decription = value End Set End Property
Private _Tasks As Dictionary(Of Integer, Task) _ Public Property Tasks() As Dictionary(Of Integer, Task) Get Return Me._Tasks End Get Set(ByVal value As Dictionary(Of Integer, Task)) _Tasks = value End Set End Property
#End Region Public Overrides Function ToString() As String Return _ShapeType End Function #Region "Implement .." Public Function GetSchema() As System.Xml.Schema.XmlSchema Implements IXmlSerializable.GetSchema Throw New System.NotImplementedException() End Function
Public Sub WriteXml(ByVal writer As XmlWriter) Implements IXmlSerializable.WriteXml writer.WriteStartElement("ShapeCustomProperties", "urn:devx-com")
writer.WriteAttributeString("ShapeName", _ShapeName) writer.WriteAttributeString("ShapeType", _ShapeType) writer.WriteAttributeString("Weight", _Weight) writer.WriteAttributeString("Physics", _Physics) writer.WriteAttributeString("ShapeImage", _ShapeImage) writer.WriteAttributeString("Decription", _Decription) writer.WriteEndElement() End Sub
Public Sub ReadXml(ByVal reader As XmlReader) Implements IXmlSerializable.ReadXml Dim type As XmlNodeType = reader.MoveToContent() If ((type = XmlNodeType.Element) And (reader.LocalName = "ShapeCustomProperties")) Then _ShapeName = reader("ShapeName") _ShapeType = reader("ShapeType") _Weight = reader("Weight") _Physics = reader("Physics") _ShapeImage = reader("ShapeImage") _Decription = reader("Decription") End If End Sub Public Function Clone() As Object Implements ICloneable.Clone Dim des As New CustomProperties 'Dim src As CustomProperties = DirectCast(MemberwiseClone(), CustomProperties) des._ShapeName = _ShapeName des._ShapeType = _ShapeType des._Weight = _Weight des._Physics = _Physics des._ShapeImage = _ShapeImage des._Decription = _Decription Return des
End Function #End Region
End Class
|