Public Class Device

    Private Net_int As String
    Private Device_int As String
    Private Schedules_int As New Dictionary(Of String, Xml.XmlNode)
    Private Calendars_int As New Dictionary(Of String, Xml.XmlNode)

    Public Property Net() As String

        Get
            Return Net_int
        End Get
        Set(ByVal value As String)
            Net_int = value
        End Set

    End Property

    Public Property Device() As String

        Get
            Return Device_int
        End Get
        Set(ByVal value As String)
            Device_int = value
        End Set

    End Property

    Public Property Schedules() As Dictionary(Of String, Xml.XmlNode)

        Get
            Return Schedules_int
        End Get
        Set(ByVal value As Dictionary(Of String, Xml.XmlNode))
            Schedules_int = value
        End Set

    End Property

    Public Property Calendars() As Dictionary(Of String, Xml.XmlNode)

        Get
            Return Calendars_int
        End Get
        Set(ByVal value As Dictionary(Of String, Xml.XmlNode))
            Calendars_int = value
        End Set

    End Property

    Public Sub AddSchedule(sName, sDescr, sInstance, sAssocLabel)


        'Dim d As New Xml.XmlDocument
        Dim xItem As Xml.XmlNode
        Dim xProp As Xml.XmlNode
        Dim xAtt As Xml.XmlAttribute


        xItem = Form1.xdoc.CreateElement("Item")
        xAtt = Form1.xdoc.CreateAttribute("id")
        xAtt.Value = sName
        xItem.Attributes.Append(xAtt)

        '   <Property id = "UseDefaultValues" > 1 </Property> 
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode("1"))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "UseDefaultValues"
        xItem.AppendChild(xProp)

        '   <Property id = "Identifier" > Instance numbe </Property>
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode(sInstance))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "Identifier"
        xItem.AppendChild(xProp)

        '   <Property id = "DescriptionLang0" > Description Schedule 01 </Property> 
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode(sDescr))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "DescriptionLang0"
        xItem.AppendChild(xProp)

        '   <Property id = "DefinedAssociatedLabel" > Associated label </Property> 
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode(sAssocLabel))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "DefinedAssociatedLabel"
        xItem.AppendChild(xProp)

        Schedules_int.Add(sInstance, xItem)

    End Sub


    Public Sub AddCalendar(sName, sDescr, sInstance)


        'Dim d As New Xml.XmlDocument
        Dim xItem As Xml.XmlNode
        Dim xProp As Xml.XmlNode
        Dim xAtt As Xml.XmlAttribute


        xItem = Form1.xdoc.CreateElement("Item")
        xAtt = Form1.xdoc.CreateAttribute("id")
        xAtt.Value = sName
        xItem.Attributes.Append(xAtt)

        '   <Property id = "Identifier" > Instance numbe </Property>
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode(sInstance))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "Identifier"
        xItem.AppendChild(xProp)

        '   <Property id = "DescriptionLang0" > Description Schedule 01 </Property> 
        xProp = xItem.AppendChild(Form1.xdoc.CreateElement("Property"))
        xProp.AppendChild(Form1.xdoc.CreateTextNode(sDescr))
        xAtt = xProp.Attributes.Append(Form1.xdoc.CreateAttribute("id"))
        xAtt.Value = "DescriptionLang0"
        xItem.AppendChild(xProp)

        Calendars_int.Add(sInstance, xItem)

    End Sub


End Class
