diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-10-12 09:20:15 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-10-12 09:20:15 +0200 |
| commit | e3fbc04e878808dd67a5c06fa22cff49d6e54e61 (patch) | |
| tree | 93f4ca398c1eb8951a6de65c529a7b0c3c025517 /src/CompilerServices/CompilerServices.cs | |
| parent | 15b8c20524fd7f5fd19c68d014a16bb6be6153e3 (diff) | |
new binding system: DynEvents compilation
Diffstat (limited to 'src/CompilerServices/CompilerServices.cs')
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 44b930e0..0d13d7bf 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -17,14 +17,17 @@ namespace go PropertyBinding } public class Binding{ - public PropertyInfo Property; + public MemberInfo SourceMember; public string Expression; + public PropertyInfo Property { get { return SourceMember as PropertyInfo; } } + public EventInfo Event { get { return SourceMember as EventInfo; } } + public Binding(){ } - public Binding(PropertyInfo _property, string _expression) + public Binding(MemberInfo _sourceMember, string _expression) { - Property = _property; + SourceMember = _sourceMember; Expression = _expression; } } @@ -45,12 +48,15 @@ namespace go public bool FindTarget(GraphicObject source){ string member = null; + //if binding exp = '{}' => binding is done on datasource if (string.IsNullOrEmpty (Binding.Expression)) { Target = source; Member = null; return true; } + //if (Binding.SourceMember.MemberType == MemberTypes.Event) + string[] bindingExp = Binding.Expression.Split ('/'); if (bindingExp.Length == 1) { @@ -81,11 +87,14 @@ namespace go string[] bindTrg = bindingExp [ptr].Split ('.'); - if (bindTrg.Length == 2) { + if (bindTrg.Length == 1) + member = bindTrg [0]; + else if (bindTrg.Length == 2){ tmp = (tmp as GraphicObject).FindByName (bindTrg [0]); member = bindTrg [1]; } else throw new Exception ("Syntax error in binding, expected 'go dot member'"); + Target = tmp; } if (Target == null) { @@ -266,14 +275,10 @@ namespace go #endregion Type[] args = {typeof(object), handlerArgsType}; - DynamicMethod dm = new DynamicMethod("dynHandle_" + dynHandleCpt, + DynamicMethod dm = new DynamicMethod("dynHandle", typeof(void), args, srcType.Module); - - es.Source.DynamicMethodIds.Add (dynHandleCpt); - - dynHandleCpt++; #region IL generation ILGenerator il = dm.GetILGenerator(256); @@ -355,7 +360,7 @@ namespace go }else{ //search if parsing methods are present MethodInfo lopTryParseMi = lopT.GetMethod("TryParse"); - + //TODO } } |