@@ -151,23 +151,52 @@ private void M_ServiceClient_Connected(object sender, System.EventArgs e)
151151
152152 if ( dll_obj . Connected != null )
153153 {
154- try
154+ IValue Action1 = dll_obj . Connected ;
155+ if ( Action1 != null )
155156 {
156- dll_obj . Connected . CallAsProcedure ( 0 , null ) ;
157+ if ( Action1 . GetType ( ) == typeof ( CsAction ) )
158+ {
159+ ReflectorContext reflector = new ReflectorContext ( ) ;
160+ try
161+ {
162+ reflector . CallMethod ( ( ( CsAction ) Action1 ) . Script , ( ( CsAction ) Action1 ) . MethodName , null ) ;
163+ }
164+ catch { }
165+ }
166+ else
167+ {
168+ try
169+ {
170+ ( ( DelegateAction ) Action1 ) . CallAsProcedure ( 0 , null ) ;
171+ }
172+ catch { }
173+ }
157174 }
158- catch { }
159175 }
160176 }
161177
162178 private void M_ServiceClient_Disconnected ( object sender , System . EventArgs e )
163179 {
164- if ( dll_obj . Disconnected != null )
180+ IValue Action1 = dll_obj . Disconnected ;
181+ if ( Action1 != null )
165182 {
166- try
183+ if ( Action1 . GetType ( ) == typeof ( CsAction ) )
184+ {
185+ ReflectorContext reflector = new ReflectorContext ( ) ;
186+ try
187+ {
188+ reflector . CallMethod ( ( ( CsAction ) Action1 ) . Script , ( ( CsAction ) Action1 ) . MethodName , null ) ;
189+ }
190+ catch { }
191+ }
192+ else
167193 {
168- dll_obj . Disconnected . CallAsProcedure ( 0 , null ) ;
194+ try
195+ {
196+ ( ( DelegateAction ) Action1 ) . CallAsProcedure ( 0 , null ) ;
197+ }
198+ catch { }
169199 }
170- catch { }
171200 }
172201 }
173202
@@ -362,10 +391,10 @@ public StructureImpl Tag
362391 }
363392
364393 [ ContextProperty ( "ПриОтключении" , "Disconnected" ) ]
365- public DelegateAction Disconnected { get ; set ; }
394+ public IValue Disconnected { get ; set ; }
366395
367396 [ ContextProperty ( "ПриПодключении" , "Connected" ) ]
368- public DelegateAction Connected { get ; set ; }
397+ public IValue Connected { get ; set ; }
369398
370399 [ ContextProperty ( "Результат" , "Resalt" ) ]
371400 public IValue Resalt
@@ -451,29 +480,10 @@ public void Connect()
451480 {
452481 Base_obj . Connect ( ) ;
453482 }
454-
455-
456-
457- //=======================================
458- private object _lock3 = new object ( ) ;
483+
459484 [ ContextMethod ( "ПолучитьИнформациюКлиентов" , "GetClientsInfo" ) ]
460485 public ArrayImpl GetClientsInfo ( )
461486 {
462- //ArrayImpl arrayImpl = new ArrayImpl();
463- //lock (_lock3)
464- //{
465- // ClientInfo[] array = Base_obj.Proxy.GetClientsList();
466- // for (int i = 0; i < array.Length; i++)
467- // {
468- // ClientInfo ClientInfo1 = (ClientInfo)array[i];
469- // CsClientInfo CsClientInfo1 = new CsClientInfo(ClientInfo1.ClientGuid, ClientInfo1.ClientName, ClientInfo1.Tag);
470- // arrayImpl.Add(CsClientInfo1);
471- // }
472- //}
473- //return arrayImpl;
474-
475-
476-
477487 ClientInfo [ ] array = Base_obj . Proxy . GetClientsList ( ) ;
478488 ArrayImpl arrayImpl = new ArrayImpl ( ) ;
479489 for ( int i = 0 ; i < array . Length ; i ++ )
0 commit comments