summaryrefslogtreecommitdiff
path: root/CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs
diff options
context:
space:
mode:
Diffstat (limited to 'CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs')
-rw-r--r--CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs51
1 files changed, 31 insertions, 20 deletions
diff --git a/CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs b/CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs
index c24ae28..ff8b2a4 100644
--- a/CSharp/Ivy/IvyPPC/IvyApplicationBinding.cs
+++ b/CSharp/Ivy/IvyPPC/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<string> arguments;
///<summary>SentMessageClasses the first word token of sent messages
///<remarks> optimise the parsing process when sending messages </remarks>
///</summary>
#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<string> 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<IvyMessageEventArgs> Callback;
public IvyApplicationBinding()
{
- arguments = new StringCollection();
+ arguments = new List<string>();
}
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<IvyMessageEventArgs> 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<IvyMessageEventArgs> 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
}