1+ using System ;
2+ using AXSharp . Connector ;
3+ using AXSharp . Connector . ValueTypes ;
4+ using System . Collections . Generic ;
5+ using AXSharp . Connector . Localizations ;
6+ using AXSharp . Abstractions . Presentation ;
7+
8+ namespace ClassWithConstantMembersNamespace
9+ {
10+ public partial class ClassWithConstantMembers : AXSharp . Connector . ITwinObject
11+ {
12+ public OnlinerInt myNonConstant { get ; }
13+
14+ partial void PreConstruct ( AXSharp . Connector . ITwinObject parent , string readableTail , string symbolTail ) ;
15+ partial void PostConstruct ( AXSharp . Connector . ITwinObject parent , string readableTail , string symbolTail ) ;
16+ public ClassWithConstantMembers ( AXSharp . Connector . ITwinObject parent , string readableTail , string symbolTail )
17+ {
18+ Symbol = AXSharp . Connector . Connector . CreateSymbol ( parent . Symbol , symbolTail ) ;
19+ this . @SymbolTail = symbolTail ;
20+ this . @Connector = parent . GetConnector ( ) ;
21+ this . @Parent = parent ;
22+ HumanReadable = AXSharp . Connector . Connector . CreateHumanReadable ( parent . HumanReadable , readableTail ) ;
23+ PreConstruct ( parent , readableTail , symbolTail ) ;
24+ myNonConstant = @Connector . ConnectorAdapter . AdapterFactory . CreateINT ( this , "myNonConstant" , "myNonConstant" ) ;
25+ parent . AddChild ( this ) ;
26+ parent . AddKid ( this ) ;
27+ PostConstruct ( parent , readableTail , symbolTail ) ;
28+ }
29+
30+ public async virtual Task < T > OnlineToPlain < T > ( eAccessPriority priority = eAccessPriority . Normal )
31+ {
32+ return await ( dynamic ) this . OnlineToPlainAsync ( priority ) ;
33+ }
34+
35+ public async Task < global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers > OnlineToPlainAsync ( eAccessPriority priority = eAccessPriority . Normal )
36+ {
37+ global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain = new global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers ( ) ;
38+ await this . ReadAsync < IgnoreOnPocoOperation > ( priority ) ;
39+ plain . myNonConstant = myNonConstant . LastValue ;
40+ return plain ;
41+ }
42+
43+ [ Obsolete ( "This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead." ) ]
44+ [ System . ComponentModel . EditorBrowsableAttribute ( System . ComponentModel . EditorBrowsableState . Never ) ]
45+ public async Task < global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers > _OnlineToPlainNoacAsync ( )
46+ {
47+ global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain = new global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers ( ) ;
48+ plain . myNonConstant = myNonConstant . LastValue ;
49+ return plain ;
50+ }
51+
52+ [ Obsolete ( "This method should not be used if you indent to access the controllers data. Use `OnlineToPlain` instead." ) ]
53+ [ System . ComponentModel . EditorBrowsableAttribute ( System . ComponentModel . EditorBrowsableState . Never ) ]
54+ protected async Task < global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers > _OnlineToPlainNoacAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain )
55+ {
56+ plain . myNonConstant = myNonConstant . LastValue ;
57+ return plain ;
58+ }
59+
60+ public async virtual Task PlainToOnline < T > ( T plain , eAccessPriority priority = eAccessPriority . Normal )
61+ {
62+ await this . PlainToOnlineAsync ( ( dynamic ) plain , priority ) ;
63+ }
64+
65+ public async Task < IEnumerable < ITwinPrimitive > > PlainToOnlineAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain , eAccessPriority priority = eAccessPriority . Normal )
66+ {
67+ #pragma warning disable CS0612
68+ myNonConstant . LethargicWrite ( plain . myNonConstant ) ;
69+ #pragma warning restore CS0612
70+ return await this . WriteAsync < IgnoreOnPocoOperation > ( priority ) ;
71+ }
72+
73+ [ Obsolete ( "This method should not be used if you indent to access the controllers data. Use `PlainToOnline` instead." ) ]
74+ [ System . ComponentModel . EditorBrowsableAttribute ( System . ComponentModel . EditorBrowsableState . Never ) ]
75+ public async Task _PlainToOnlineNoacAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain )
76+ {
77+ #pragma warning disable CS0612
78+ myNonConstant . LethargicWrite ( plain . myNonConstant ) ;
79+ #pragma warning restore CS0612
80+ }
81+
82+ public async virtual Task < T > ShadowToPlain < T > ( )
83+ {
84+ return await ( dynamic ) this . ShadowToPlainAsync ( ) ;
85+ }
86+
87+ public async Task < global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers > ShadowToPlainAsync ( )
88+ {
89+ global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain = new global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers ( ) ;
90+ plain . myNonConstant = myNonConstant . Shadow ;
91+ return plain ;
92+ }
93+
94+ protected async Task < global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers > ShadowToPlainAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain )
95+ {
96+ plain . myNonConstant = myNonConstant . Shadow ;
97+ return plain ;
98+ }
99+
100+ public async virtual Task PlainToShadow < T > ( T plain )
101+ {
102+ await this . PlainToShadowAsync ( ( dynamic ) plain ) ;
103+ }
104+
105+ public async Task < IEnumerable < ITwinPrimitive > > PlainToShadowAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain )
106+ {
107+ myNonConstant . Shadow = plain . myNonConstant ;
108+ return this . RetrievePrimitives ( ) ;
109+ }
110+
111+ ///<inheritdoc/>
112+ public async virtual Task < bool > AnyChangeAsync < T > ( T plain )
113+ {
114+ return await this . DetectsAnyChangeAsync ( ( dynamic ) plain ) ;
115+ }
116+
117+ ///<summary>
118+ ///Compares if the current plain object has changed from the previous object.This method is used by the framework to determine if the object has changed and needs to be updated.
119+ ///[!NOTE] Any member in the hierarchy that is ignored by the compilers (e.g. when CompilerOmitAttribute is used) will not be compared, and therefore will not be detected as changed.
120+ ///</summary>
121+ public async Task < bool > DetectsAnyChangeAsync ( global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers plain , global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers latest = null )
122+ {
123+ if ( latest == null )
124+ latest = await this . _OnlineToPlainNoacAsync ( ) ;
125+ var somethingChanged = false ;
126+ return await Task . Run ( async ( ) =>
127+ {
128+ if ( plain . myNonConstant != myNonConstant . LastValue )
129+ somethingChanged = true ;
130+ plain = latest ;
131+ return somethingChanged ;
132+ } ) ;
133+ }
134+
135+ public void Poll ( )
136+ {
137+ this . RetrievePrimitives ( ) . ToList ( ) . ForEach ( x => x . Poll ( ) ) ;
138+ }
139+
140+ public global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers CreateEmptyPoco ( )
141+ {
142+ return new global ::Pocos . ClassWithConstantMembersNamespace . ClassWithConstantMembers ( ) ;
143+ }
144+
145+ private IList < AXSharp . Connector . ITwinObject > Children { get ; } = new List < AXSharp . Connector . ITwinObject > ( ) ;
146+
147+ public IEnumerable < AXSharp . Connector . ITwinObject > GetChildren ( )
148+ {
149+ return Children ;
150+ }
151+
152+ private IList < AXSharp . Connector . ITwinElement > Kids { get ; } = new List < AXSharp . Connector . ITwinElement > ( ) ;
153+
154+ public IEnumerable < AXSharp . Connector . ITwinElement > GetKids ( )
155+ {
156+ return Kids ;
157+ }
158+
159+ private IList < AXSharp . Connector . ITwinPrimitive > ValueTags { get ; } = new List < AXSharp . Connector . ITwinPrimitive > ( ) ;
160+
161+ public IEnumerable < AXSharp . Connector . ITwinPrimitive > GetValueTags ( )
162+ {
163+ return ValueTags ;
164+ }
165+
166+ public void AddValueTag ( AXSharp . Connector . ITwinPrimitive valueTag )
167+ {
168+ ValueTags . Add ( valueTag ) ;
169+ }
170+
171+ public void AddKid ( AXSharp . Connector . ITwinElement kid )
172+ {
173+ Kids . Add ( kid ) ;
174+ }
175+
176+ public void AddChild ( AXSharp . Connector . ITwinObject twinObject )
177+ {
178+ Children . Add ( twinObject ) ;
179+ }
180+
181+ protected AXSharp . Connector . Connector @Connector { get ; }
182+
183+ public AXSharp . Connector . Connector GetConnector ( )
184+ {
185+ return this . @Connector ;
186+ }
187+
188+ public string GetSymbolTail ( )
189+ {
190+ return this . SymbolTail ;
191+ }
192+
193+ public AXSharp . Connector . ITwinObject GetParent ( )
194+ {
195+ return this . @Parent ;
196+ }
197+
198+ public string Symbol { get ; protected set ; }
199+
200+ private string _attributeName ;
201+ public System . String AttributeName { get => string . IsNullOrEmpty ( _attributeName ) ? SymbolTail : _attributeName . Interpolate ( this ) . CleanUpLocalizationTokens ( ) ; set => _attributeName = value ; }
202+
203+ public System . String GetAttributeName ( System . Globalization . CultureInfo culture )
204+ {
205+ if ( string . IsNullOrEmpty ( _attributeName ) )
206+ {
207+ return SymbolTail ;
208+ }
209+
210+ return this . Translate ( _attributeName , culture ) . Interpolate ( this ) ;
211+ }
212+
213+ private string _humanReadable ;
214+ public string HumanReadable { get => string . IsNullOrEmpty ( _humanReadable ) ? SymbolTail : _humanReadable . Interpolate ( this ) . CleanUpLocalizationTokens ( ) ; set => _humanReadable = value ; }
215+
216+ public System . String GetHumanReadable ( System . Globalization . CultureInfo culture )
217+ {
218+ return this . Translate ( _humanReadable , culture ) ;
219+ }
220+
221+ protected System . String @SymbolTail { get ; set ; }
222+ protected AXSharp . Connector . ITwinObject @Parent { get ; set ; }
223+ public AXSharp . Connector . Localizations . Translator Interpreter => global ::units . PlcTranslator . Instance ;
224+ }
225+ }
0 commit comments