diff options
author | fcolin | 2007-02-01 12:05:47 +0000 |
---|---|---|
committer | fcolin | 2007-02-01 12:05:47 +0000 |
commit | 3593a483d5566779f1d56e037615685cdc77c0a0 (patch) | |
tree | 300986bb2f463148fd0773efc5f69654ae2cd53f /IvyToDel/IvyPPC/IvyApplicationBinding.cs | |
parent | 3ce9b3f180e3f52c7be79e0a23bbd1a0b5120ac6 (diff) | |
download | ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.zip ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.gz ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.bz2 ivy-csharp-3593a483d5566779f1d56e037615685cdc77c0a0.tar.xz |
modification structure svn
Diffstat (limited to 'IvyToDel/IvyPPC/IvyApplicationBinding.cs')
-rw-r--r-- | IvyToDel/IvyPPC/IvyApplicationBinding.cs | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/IvyToDel/IvyPPC/IvyApplicationBinding.cs b/IvyToDel/IvyPPC/IvyApplicationBinding.cs deleted file mode 100644 index 9183850..0000000 --- a/IvyToDel/IvyPPC/IvyApplicationBinding.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using System.ComponentModel;
-using System.Threading;
-
-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
- {
- private BindingType binding;
-
-#if (!PocketPC)
- [Category("Ivy")]
-#endif
- public BindingType Binding
- {
- get { return binding; }
- 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;
-#if (!PocketPC)
- [Browsable(false)]
- [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
-#endif
- public object[] Args
- {
- get { return args; }
- set { args = value; }
- }
- private string expression;
-#if (!PocketPC)
- [Category("Ivy")]
-#endif
- [DefaultValue(null)]
- public string Expression
- {
- get { return expression; }
- set { expression = value; }
- }
- private string formated_expression;
- public string FormatedExpression
- {
- get
- {
- FormatExpression();
- return formated_expression;
- }
- }
-
- 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")]
-
- [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")]
-#endif
- public List<string> Arguments
- {
- get
- {
- return arguments;
- }
- }
-
-#if (!PocketPC)
- [Category("Ivy")]
- [Description("Event fired when Message Matching expression received")]
-#endif
- public event EventHandler<IvyMessageEventArgs> Callback;
-
- public IvyApplicationBinding()
- {
- arguments = new List<string>();
- }
- public IvyApplicationBinding(IContainer container)
- : this()
- {
- container.Add(this);
- }
- // translate part of expression to object property
- public void FormatExpression()
- {
- //// Safely :
-#if (!PocketPC)//TODO Pocket PC doesn't have Target Member
- EventHandler<IvyMessageEventArgs> temp = Callback;
- if (temp != null)
- {
- //TODO Pocket PC doesn't have Target Member
- object target = temp.Target;
- if (args == null)
- {
- args = new object[arguments.Count];
- for (int i = 0; i < arguments.Count; i++)
- {
- System.Reflection.PropertyInfo prop = target.GetType().GetProperty(arguments[i]);
- if (prop != null)
- args[i] = prop.GetValue(target, null);
- else //TODO what else BUG msgbox in desing mode !!!
- args[i] = arguments[i];
- }
- }
- formated_expression = string.Format(expression, args);
- }
- else //TODO Abnormal condition Design Time
-#endif
- formated_expression = expression;
-
- }
-
-#if ( PocketPC )
- internal void Firevent(System.Windows.Forms.Control control, IvyMessageEventArgs e)
- {
- //// Safely invoke an event:
- EventHandler<IvyMessageEventArgs> temp = Callback;
-
- if (temp == null)
- {
- throw new IvyException("(callCallback) Not callback for id " + e.Id);
- }
- if (control != null)
- {
- control.Invoke(temp, this, e);
- }
- else
- temp(this, e);
- }
-#else
- internal void Firevent(System.Threading.SynchronizationContext syncContext, IvyMessageEventArgs e)
- {
- //// Safely invoke an event:
- EventHandler<IvyMessageEventArgs> temp = Callback;
-
- if (temp == null)
- {
- throw new IvyException("(callCallback) Not callback for id " + e.Id);
- }
- if (syncContext != null)
- {
- SendOrPostCallback update = delegate(object state)
- {
- IvyMessageEventArgs args = (IvyMessageEventArgs)state;
- temp(this, args);
- };
- syncContext.Post(update, e);
- }
- else
- temp(this, e);
- }
-
-#endif
- }
-
-}
|