File size: 4,247 Bytes
b1b3bae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
'    Miscelaneous Classes
'    Copyright 2008-2015 Daniel Wagner O. de Medeiros
'
'    This file is part of DWSIM.
'
'    DWSIM is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.
'
'    DWSIM is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.
'
'    You should have received a copy of the GNU General Public License
'    along with DWSIM.  If not, see <http://www.gnu.org/licenses/>.

Imports System.Runtime.Serialization
Imports System.Reflection
Imports System.Linq
Imports CapeOpen

Namespace Extras

    <CLSCompliant(True)> <System.Serializable()> Public Class NodeItem

        Private m_checked As Boolean = False
        Private m_text As String
        Private m_value As String
        Private m_unit As String
        Private m_level As Integer = 0
        Private m_parentnode As String
        Private m_key As Integer

        Public Property CustomText As String = ""

        Sub New()

        End Sub

        Sub New(ByVal texto As String, ByVal valor As String, ByVal unidade As String, ByVal key As Integer, ByVal nivel As Integer, ByVal pai As String)
            Me.m_value = valor
            Me.m_unit = unidade
            Me.m_text = texto
            Me.m_key = key
            Me.m_parentnode = pai
            Me.m_level = nivel
        End Sub

        Public Property Checked() As Boolean
            Get
                Return m_checked
            End Get
            Set(ByVal value As Boolean)
                m_checked = value
            End Set
        End Property

        Public Property Text() As String
            Get
                Return m_text
            End Get
            Set(ByVal value As String)
                m_text = value
            End Set
        End Property

        Public Property Value() As String
            Get
                Return m_value
            End Get
            Set(ByVal value As String)
                m_value = value
            End Set
        End Property

        Public Property Unit() As String
            Get
                Return m_unit
            End Get
            Set(ByVal value As String)
                m_unit = value
            End Set
        End Property

        Public Property Level() As Integer
            Get
                Return m_level
            End Get
            Set(ByVal value As Integer)
                m_level = value
            End Set
        End Property

        Public Property ParentNode() As String
            Get
                Return m_parentnode
            End Get
            Set(ByVal value As String)
                m_parentnode = value
            End Set
        End Property

        Public Property Key() As String
            Get
                Return m_key
            End Get
            Set(ByVal value As String)
                m_key = value
            End Set
        End Property

    End Class

    <System.Serializable()> Public Class WatchItem

        Implements Interfaces.ICustomXMLSerialization, IWatchItem

        Public Property ObjID As String = "" Implements IWatchItem.ObjID
        Public Property PropID As String = "" Implements IWatchItem.PropID
        Public Property ROnly As Boolean = False Implements IWatchItem.IsReadOnly

        Sub New()

        End Sub

        Sub New(ByVal oid As String, ByVal pid As String, ByVal ro As Boolean)
            ObjID = oid
            PropID = pid
            ROnly = ro
        End Sub

        Public Function LoadData(data As List(Of XElement)) As Boolean Implements Interfaces.ICustomXMLSerialization.LoadData
            XMLSerializer.XMLSerializer.Deserialize(Me, data)
            Return True
        End Function

        Public Function SaveData() As List(Of XElement) Implements Interfaces.ICustomXMLSerialization.SaveData
            Return XMLSerializer.XMLSerializer.Serialize(Me)
        End Function

    End Class

End Namespace