summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy/IvyPPC')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs28
1 files changed, 24 insertions, 4 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 82979c0..5d2a8b0 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -44,6 +44,7 @@ namespace IvyBus
public delegate ApplicationExit DieHandler(IvyClient app, int id, string arg);
public delegate void ClientAddBindingHandler(IvyClient app, string arg);
public delegate void ClientRemoveBindingHandler(IvyClient app, string arg);
+ public delegate void ErrorMessageHandler(IvyClient app, int id, string arg);
public delegate void MessageHandler(IvyClient app, string[] args);
@@ -65,6 +66,8 @@ namespace IvyBus
public event ClientAddBindingHandler BindingAdd;
/// <summary>fires when a client receive a remove binding from another client</summary>
public event ClientRemoveBindingHandler BindingRemove;
+ /// <summary>fires when a client receive a remove binding from another client</summary>
+ public event ErrorMessageHandler ErrorMessage;
#if (!PocketPC)
[Category("Ivy")]
@@ -774,6 +777,7 @@ namespace IvyBus
if (syncControl != null
#if (!PocketPC )
&& syncControl.Created
+ && ! syncControl.IsDisposed
#endif
)
return true;
@@ -802,9 +806,16 @@ namespace IvyBus
{
if (ClientDisconnected != null)
{
- if (IsSynchronous())
- syncControl.Invoke(ClientDisconnected, new object[] { app });
- else ClientDisconnected(app);
+ try
+ {
+ if (IsSynchronous())
+ syncControl.Invoke(ClientDisconnected, new object[] { app });
+ else ClientDisconnected(app);
+ }
+ catch (ObjectDisposedException ie)
+ {
+ // protect terminaison
+ }
}
}
internal void FireClientAddBinding(IvyClient app, string regexp)
@@ -835,7 +846,15 @@ namespace IvyBus
}
return ApplicationExit.FORCE_EXIT;
}
-
+ internal void FireError(IvyClient client, int id, string arg)
+ {
+ if (ErrorMessage != null)
+ {
+ if (IsSynchronous())
+ syncControl.Invoke(ErrorMessage, new object[] { client, id, arg });
+ else ErrorMessage(client, id, arg);
+ }
+ }
/*
* removes a client from the list
@@ -893,6 +912,7 @@ namespace IvyBus
syncControl.Invoke(bind.callback, new object[] { client, arg });
else bind.callback(client, arg);
}
+
public static IPAddress getLocalIP()
{
IPAddress returnaddr = null;