From ce9ef77b5e785a1475176bdbd1d9d690357afab4 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:45:12 +0000 Subject: Utilisateur : Fcolin Date : 30/06/06 Heure : 16:43 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 4) --- CSharp/Ivy/Ivy/IvyApplicationBinding.cs | 51 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/IvyApplicationBinding.cs b/CSharp/Ivy/Ivy/IvyApplicationBinding.cs index c24ae28..ff8b2a4 100644 --- a/CSharp/Ivy/Ivy/IvyApplicationBinding.cs +++ b/CSharp/Ivy/Ivy/IvyApplicationBinding.cs @@ -10,9 +10,10 @@ namespace IvyBus /* This is the Application side of binding storage */ /* association of a generated Key and a delegate and the expression */ /* this is SEND to other client */ - +#if (!PocketPC) [PropertyTab(typeof(System.Windows.Forms.Design.EventsTab), PropertyTabScope.Component)] [DefaultEvent("Callback")] +#endif [DesignerCategory("Component")] [DesignTimeVisible(false)] /* should be added via Ivy component */ public class IvyApplicationBinding : System.ComponentModel.Component @@ -28,17 +29,22 @@ namespace IvyBus set { binding = value; } } private ushort key; + + #if (!PocketPC) [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif public ushort Key { get { return key; } set { key = value; } } - private object[] args; + private object[] args; +#if (!PocketPC) [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] +#endif public object[] Args { get { return args; } @@ -64,21 +70,24 @@ namespace IvyBus } } - private StringCollection arguments; + private List arguments; ///SentMessageClasses the first word token of sent messages /// optimise the parsing process when sending messages /// #if (!PocketPC) [Category("Ivy")] -#endif + [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] + // sinon bug System.String constructor not found ! [Editor( "System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor,System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" )] + [Description("Arguments used when formating the expression")] - public StringCollection Arguments +#endif + public List Arguments { get { @@ -88,13 +97,13 @@ namespace IvyBus #if (!PocketPC) [Category("Ivy")] -#endif [Description("Event fired when Message Matching expression received")] +#endif public event EventHandler Callback; public IvyApplicationBinding() { - arguments = new StringCollection(); + arguments = new List(); } public IvyApplicationBinding(IContainer container) : this() @@ -106,7 +115,8 @@ namespace IvyBus { if (Callback != null) { - object target = Callback.Target; + //TODO object target = Callback.Target; + object target = Site.Component; if (args == null) { args = new object[arguments.Count]; @@ -126,8 +136,8 @@ namespace IvyBus } -#if ( SyncContext) - internal void Firevent(System.Threading.SynchronizationContext syncContext, IvyMessageEventArgs e) +#if ( PocketPC ) + internal void Firevent(System.Windows.Forms.Control control, IvyMessageEventArgs e) { //// Safely invoke an event: EventHandler temp = Callback; @@ -136,20 +146,15 @@ namespace IvyBus { throw new IvyException("(callCallback) Not callback for id " + e.Id); } - if (syncContext != null) + if (control != null) { - SendOrPostCallback update = delegate(object state) - { - IvyMessageEventArgs args = (IvyMessageEventArgs)state; - temp(this, args); - }; - syncContext.Send(update, e); + control.Invoke(temp, this, e); } else temp(this, e); } #else - internal void Firevent(System.Windows.Forms.Control control, IvyMessageEventArgs e) + internal void Firevent(System.Threading.SynchronizationContext syncContext, IvyMessageEventArgs e) { //// Safely invoke an event: EventHandler temp = Callback; @@ -158,13 +163,19 @@ namespace IvyBus { throw new IvyException("(callCallback) Not callback for id " + e.Id); } - if (control != null) + if (syncContext != null) { - control.Invoke(temp,this, e); + SendOrPostCallback update = delegate(object state) + { + IvyMessageEventArgs args = (IvyMessageEventArgs)state; + temp(this, args); + }; + syncContext.Send(update, e); } else temp(this, e); } + #endif } -- cgit v1.1