@@ -14,11 +14,11 @@ public class OneScriptClientServer : AutoContext<OneScriptClientServer>
1414 public static CsServiceApplication CurrentServiceApplication = null ;
1515 public static CsServiceClient CurrentServiceClient = null ;
1616 public static IValue Event = null ;
17- public static DelegateAction EventAction = null ;
17+ public static IValue EventAction = null ;
1818 public static ConcurrentQueue < dynamic > EventQueue = new ConcurrentQueue < dynamic > ( ) ;
1919 public static bool goOn = true ;
20- public static DelegateAction ServerMessageReceived ;
21- public static DelegateAction ServerMessageSent ;
20+ public static IValue ServerMessageReceived ;
21+ public static IValue ServerMessageSent ;
2222 public static bool thirdPartyClientMode = false ;
2323
2424 [ ScriptConstructor ]
@@ -67,6 +67,12 @@ public CsTcpClient TcpClient(CsTcpEndPoint p1)
6767 return new CsTcpClient ( p1 ) ;
6868 }
6969
70+ [ ContextMethod ( "Действие" , "Action" ) ]
71+ public CsAction Action ( IRuntimeContextInstance script , string methodName )
72+ {
73+ return new CsAction ( script , methodName ) ;
74+ }
75+
7076 [ ContextMethod ( "TCPКонечнаяТочка" , "TcpEndPoint" ) ]
7177 public CsTcpEndPoint TcpEndPoint ( string p1 , int p2 )
7278 {
@@ -86,10 +92,16 @@ public DelegateAction DoEvents()
8692 {
8793 System . Threading . Thread . Sleep ( 7 ) ;
8894 }
89- return EventHandling ( ) ;
95+
96+ IValue Action1 = EventHandling ( ) ;
97+ if ( Action1 . GetType ( ) == typeof ( CsAction ) )
98+ {
99+ return DelegateAction . Create ( ( ( CsAction ) Action1 ) . Script , ( ( CsAction ) Action1 ) . MethodName ) ;
100+ }
101+ return ( DelegateAction ) Action1 ;
90102 }
91103
92- public static DelegateAction EventHandling ( )
104+ public static IValue EventHandling ( )
93105 {
94106 dynamic EventArgs1 ;
95107 EventQueue . TryDequeue ( out EventArgs1 ) ;
0 commit comments