summaryrefslogtreecommitdiff
path: root/CSharp/Ivy
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:55:16 +0000
committerfcolin2007-02-01 09:55:16 +0000
commit0c03d986aeccd723021fdd164634f8d7ce8f8166 (patch)
tree03f8802aa8c8afdc601e9ccc8039fcceb4b07b73 /CSharp/Ivy
parent75127418f38e09c30222233453ab54f76e4c3386 (diff)
downloadivy-csharp-0c03d986aeccd723021fdd164634f8d7ce8f8166.zip
ivy-csharp-0c03d986aeccd723021fdd164634f8d7ce8f8166.tar.gz
ivy-csharp-0c03d986aeccd723021fdd164634f8d7ce8f8166.tar.bz2
ivy-csharp-0c03d986aeccd723021fdd164634f8d7ce8f8166.tar.xz
Utilisateur : Fcolin Date : 23/01/06 Heure : 18:08 Archivé dans $/CSharp/Ivy/Ivy Commentaire: (vss 40)
Diffstat (limited to 'CSharp/Ivy')
-rw-r--r--CSharp/Ivy/IvyPPC/Ivy.cs70
1 files changed, 51 insertions, 19 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs
index 30b5592..40caf48 100644
--- a/CSharp/Ivy/IvyPPC/Ivy.cs
+++ b/CSharp/Ivy/IvyPPC/Ivy.cs
@@ -57,7 +57,7 @@ namespace IvyBus
/// <summary>fires when a client receive a remove binding from another client</summary>
public event ClientRemoveBindingHandler BindingRemove;
-
+ [Category("Ivy")]
public bool Debug
{
get
@@ -70,7 +70,7 @@ namespace IvyBus
}
}
-
+ [Category("Ivy")]
public CultureInfo Culture
{
get
@@ -85,7 +85,8 @@ namespace IvyBus
}
/// <summary>IvyClients accesses the list of the connected clients</summary>
- public List<IvyClient> IvyClients
+ [Browsable(false)]
+ public List<IvyClient> IvyClients
{
get
{
@@ -93,8 +94,8 @@ namespace IvyBus
}
}
- /// <summary>ClientNames accesses the name list of the connected clients</summary>
- private string ClientNames
+ /// <summary>ClientNames accesses the name list of the connected clients</summary
+ private string ClientNames
{
get
{
@@ -114,7 +115,8 @@ namespace IvyBus
}
/// <summary>AppName the application name</summary>
- public string AppName
+ [Category("Ivy")]
+ public string AppName
{
set
{
@@ -126,7 +128,8 @@ namespace IvyBus
}
}
- public string AppId
+ [Browsable(false)]
+ public string AppId
{
get
{
@@ -134,6 +137,7 @@ namespace IvyBus
}
}
+ [Category("Ivy")]
public ushort AppPriority
{
set
@@ -154,6 +158,7 @@ namespace IvyBus
}
}
+ [Browsable(false)]
public int ProtocolVersion
{
get
@@ -165,6 +170,7 @@ namespace IvyBus
///<summary>SentMessageClasses the first word token of sent messages
///<remarks> optimise the parsing process when sending messages </remarks>
///</summary>
+ [Category("Ivy")]
public string[] SentMessageClasses
{
get
@@ -189,14 +195,14 @@ namespace IvyBus
}
/// the name of the application on the bus
- internal string appName;
+ internal string appName;
/// the port for the UDP rendez vous, if none is supplied
internal const ushort DEFAULT_PORT = 2010;
// client default priority
internal const ushort DEFAULT_PRIORITY = 100;
/// the domain for the UDP rendez vous
- internal static readonly string DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT;
- internal const string libVersion = "2.0.0";
+ private static readonly string DEFAULT_DOMAIN = "127.255.255.255:" + DEFAULT_PORT;
+ private const string libVersion = "2.0.0";
internal int protocolVersion = 3;
private bool debug = false;
private static ushort serial = 0; /* an unique ID for each regexp */
@@ -222,16 +228,27 @@ namespace IvyBus
internal IPAddress applicationHost; /* Application host number */
internal string applicationUniqueId; /* identifier Application unique timestamp-ipaddress-port */
internal ushort applicationPriority = DEFAULT_PRIORITY;
- internal string ready_message = null;
- internal CultureInfo culture = new CultureInfo("en-us");
-
- // for synchronous event
+ private string ready_message = null;
+ private CultureInfo culture = new CultureInfo("en-us");
+ // for synchronous event
private Control syncControl = null;
-
+
+ [Category("Ivy")]
+ public string ReadyMessage
+ {
+ get { return ready_message; }
+ set { ready_message = value; }
+ }
+
+
+ [Category("Ivy")]
public Control SyncControl
{
get { return syncControl; }
- set { syncControl = value; }
+ set {
+ syncControl = value;
+ AutoBinding(syncControl);
+ }
}
public Ivy()
{
@@ -277,19 +294,34 @@ namespace IvyBus
{
syncControl = sync;
}
+ // Autobinding on static method
public void AutoBinding(Type type)
{
- //Get instance of the IvyBindingAttribute.
+ //Get instance of the IvyBindingAttribute.
foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
{
- Console.WriteLine("IvyBinding Method " + m.Name);
foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute)))
{
//TODO check paramater type MessageHandler
- Console.WriteLine("IvyBinding " + attr.Expression);
+ Console.WriteLine("IvyBinding " + attr.Expression + "to Method " + m.Name);
bindMsg(attr.Expression, (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), m));
}
}
+ }
+ // Autobinding on instance method
+ public void AutoBinding(object obj)
+ {
+ Type type = obj.GetType();
+ //Get instance of the IvyBindingAttribute.
+ foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
+ {
+ foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute)))
+ {
+ //TODO check paramater type MessageHandler
+ Console.WriteLine("IvyBinding " + attr.Expression + "to Method " + m.Name);
+ bindMsg(attr.Expression, (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), obj, m));
+ }
+ }
}
/// <summary> connects the Ivy bus to a domain or list of domains.