From ff6372421041404154c11cd4e8d3ad0ee1778614 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:43:01 +0000 Subject: Utilisateur : Fcolin Date : 12/01/06 Heure : 9:46 Archivé dans $/CSharp/Ivy Commentaire: (vss 32) --- CSharp/Ivy/Ivy/Ivy.cs | 58 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 24 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index b1b9cdd..7f4ae81 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -249,10 +249,7 @@ namespace IvyBus /// public void start(string domainbus) { - if (domainbus == null) - domainbus = Environment.GetEnvironmentVariable("IVYBUS"); - if (domainbus == null) - domainbus = DEFAULT_DOMAIN; + domainbus = getDomain(domainbus); try { IPAddress localaddr = Dns.Resolve(Dns.GetHostName()).AddressList[0]; @@ -484,7 +481,7 @@ namespace IvyBus { foreach (IvyClient c in clients ) { - c.stream.TokenAddRegexp(newbind); + c.stream.TokenAddBinding(newbind); } } return newbind.key; @@ -572,7 +569,7 @@ namespace IvyBus { foreach (IvyClient c in clients ) { - c.stream.TokenAddBinding(newbind.key, newbind.expression); + c.stream.TokenAddBinding(newbind); } } return newbind.key; @@ -591,11 +588,36 @@ namespace IvyBus v[i].stream.TokenPing(message); return v.Count; } +// internal object FireEvents(Delegate eventDelegate, params object[] args) +// { +// if (eventDelegate != null) +// { +// if (syncControl != null +//#if (!PocketPC ) +// && syncControl.Created +//#endif +// ) +// return syncControl.Invoke(eventDelegate, args); +// else return eventDelegate(args); +// } +// return null; +// } + internal void FireCallback(IvyClient client, int key, string[] arg) + { + ApplicationBinding bind = bindings[key]; + if (bind.callback == null) + { + throw new IvyException("(callCallback) Not regexp matching id " + key); + } + if (syncControl != null && syncControl.Created) + syncControl.Invoke(bind.callback, new object[] { client, arg }); + else bind.callback(client, arg); + } internal void FireDirectMessage(IvyClient app, int id, string arg) { if ( directMessageReceived != null ) { - if ( syncControl != null ) + if (syncControl != null && syncControl.Created) syncControl.Invoke( directMessageReceived, new object[]{app,id,arg}); else directMessageReceived( app, id, arg); } @@ -604,7 +626,7 @@ namespace IvyBus { if ( clientConnected != null ) { - if ( syncControl != null ) + if (syncControl != null && syncControl.Created) syncControl.Invoke( clientConnected, new object[]{app}); else clientConnected( app); } @@ -613,7 +635,7 @@ namespace IvyBus { if ( clientDisconnected != null ) { - if ( syncControl != null ) + if ( syncControl != null && syncControl.Created ) syncControl.Invoke( clientDisconnected, new object[]{app}); else clientDisconnected( app); } @@ -622,7 +644,7 @@ namespace IvyBus { if ( addBinding != null ) { - if ( syncControl != null ) + if (syncControl != null && syncControl.Created) syncControl.Invoke( addBinding, new object[]{app,regexp}); else addBinding( app,regexp); } @@ -631,7 +653,7 @@ namespace IvyBus { if ( removeBinding != null ) { - if ( syncControl != null ) + if (syncControl != null && syncControl.Created) syncControl.Invoke( removeBinding, new object[]{app,regexp}); else removeBinding( app,regexp); } @@ -640,7 +662,7 @@ namespace IvyBus { if ( dieReceived != null ) { - if ( syncControl != null ) + if (syncControl != null && syncControl.Created) syncControl.Invoke( dieReceived, new object[]{app,id,arg}); else return dieReceived( app, id, arg); } @@ -692,18 +714,6 @@ namespace IvyBus } traceDebug(ClientNames); } - - internal void FireCallback(IvyClient client, int key, string[] arg) - { - ApplicationBinding bind = bindings[key]; - if (bind.callback == null) - { - throw new IvyException("(callCallback) Not regexp matching id " + key); - } - if ( syncControl != null ) - syncControl.Invoke(bind.callback, new object[] { client, arg }); - else bind.callback(client, arg); - } public static string getDomain(string domainbus) -- cgit v1.1