summaryrefslogtreecommitdiff
path: root/IvyControl/IvyApplicationBindingControl.cs
blob: 577229567b2009e331998165227dce4ac02a5ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.ComponentModel;
using System.Threading;
using System.Collections.ObjectModel;

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 IvyApplicationBindingControl : System.ComponentModel.Component
    {
        public IvyApplicationBinding binding;

#if (!PocketPC)
        [Category("Ivy")]
#endif
        public BindingType Binding
        {
            get { return binding.Binding; }
            set { binding.Binding = value; }
        }
        

#if (!PocketPC)
        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
        public int Key
        {
            get { return binding.Key; }
            set { binding.Key = value; }
        }

        
#if (!PocketPC)
        [Category("Ivy")]
#endif
        [DefaultValue(null)]
        public string Expression
        {
            get { return binding.Expression; }
            set { binding.Expression = value; }
        }
        public string FormatedExpression
        {
            get
            {
                return binding.FormattedExpression;
            }
        }

        ///<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 Collection<string> Arguments
        {
            get
            {
                return binding.Arguments;
            }
        }

#if (!PocketPC)
        [Category("Ivy")]
        [Description("Event fired when Message Matching expression received")]
#endif
        public event EventHandler<IvyMessageEventArgs> Callback
        {
            add
            {
                binding.Callback += value;
            }
            remove
            {
                binding.Callback -= value;
            }
        }

        public IvyApplicationBindingControl()
        {
            binding = new IvyApplicationBinding();
        }
        public IvyApplicationBindingControl(IContainer container)
            : this()
        {
            container.Add(this);
        }
        
    }
  
}