summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:54:08 +0000
committerfcolin2007-02-01 09:54:08 +0000
commit03d9ff262a599dcbd6a15f2eee54d54969a042a0 (patch)
tree068e1766c0a5fe76ad70b431ac642c8b2ab67fd5 /CSharp/Ivy
parent7b7961129ae8620108acba9d8e623322a4af1c61 (diff)
downloadivy-csharp-03d9ff262a599dcbd6a15f2eee54d54969a042a0.zip
ivy-csharp-03d9ff262a599dcbd6a15f2eee54d54969a042a0.tar.gz
ivy-csharp-03d9ff262a599dcbd6a15f2eee54d54969a042a0.tar.bz2
ivy-csharp-03d9ff262a599dcbd6a15f2eee54d54969a042a0.tar.xz
Utilisateur : Fcolin Date : 6/08/03 Heure : 17:27 Archivé dans $/EScribe/Ivy Commentaire: (vss 6)
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs37
1 files changed, 31 insertions, 6 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 47f427b..ed4c4aa 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -12,6 +12,7 @@ namespace IvyBus
using System.Net.Sockets;
using System.Threading;
using System.Configuration;
+ using System.Windows.Forms;
/// <summary> The Main bus Class
/// </summary>
@@ -108,6 +109,8 @@ namespace IvyBus
internal Hashtable regexp_out;
internal String ready_message = null;
+ // for synchronous event
+ private Control syncControl = null;
/// <summary> Readies the structures for the software bus connexion.
/// </summary>
/// <example> This sample shows how to start working with Ivy.
@@ -141,6 +144,10 @@ namespace IvyBus
if ( debug_str != null )
debug = bool.Parse(debug_str);
}
+ public Ivy(String name, String message, Control sync) :this( name, message )
+ {
+ syncControl = sync;
+ }
/// <summary> connects the Ivy bus to a domain or list of domains.
/// </summary>
@@ -371,23 +378,39 @@ namespace IvyBus
internal void FireDirectMessage (IvyClient app, int id, string arg )
{
if ( directMessageReceived != null )
- directMessageReceived( app, id, arg);
+ {
+ if ( syncControl != null )
+ syncControl.Invoke( directMessageReceived, new object[]{app,id,arg});
+ else directMessageReceived( app, id, arg);
+ }
}
internal void FireClientConnected (IvyClient app)
{
if ( clientConnected != null )
- clientConnected( app);
+ {
+ if ( syncControl != null )
+ syncControl.Invoke( clientConnected, new object[]{app});
+ else clientConnected( app);
+ }
}
internal void FireClientDisconnected (IvyClient app)
{
if ( clientDisconnected != null )
- clientDisconnected( app);
+ {
+ if ( syncControl != null )
+ syncControl.Invoke( clientDisconnected, new object[]{app});
+ else clientDisconnected( app);
+ }
}
internal bool FireDie (IvyClient app, int id )
{
if ( dieReceived != null )
- return dieReceived( app, id);
- else return false;
+ {
+ if ( syncControl != null )
+ syncControl.Invoke( dieReceived, new object[]{app,id});
+ else return dieReceived( app, id);
+ }
+ return false;
}
@@ -446,7 +469,9 @@ namespace IvyBus
{
throw new IvyException("(callCallback) Not regexp matching id " + key);
}
- callback(client, tab);
+ if ( syncControl != null )
+ syncControl.Invoke( callback, new object[]{client,tab});
+ else callback(client, tab);
}
private static String[] myTokenize(String s, String separator)