summaryrefslogtreecommitdiff
path: root/src/bindings/mono/efl_mono/UserModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mono/efl_mono/UserModel.cs')
-rw-r--r--src/bindings/mono/efl_mono/UserModel.cs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/bindings/mono/efl_mono/UserModel.cs b/src/bindings/mono/efl_mono/UserModel.cs
index 1116dfc..99350b1 100644
--- a/src/bindings/mono/efl_mono/UserModel.cs
+++ b/src/bindings/mono/efl_mono/UserModel.cs
@@ -27,9 +27,12 @@ internal class ModelHelper
27 static internal void SetProperties<T>(T o, Efl.IModel child) 27 static internal void SetProperties<T>(T o, Efl.IModel child)
28 { 28 {
29 var properties = typeof(T).GetProperties(); 29 var properties = typeof(T).GetProperties();
30 foreach(var prop in properties) 30 foreach (var prop in properties)
31 { 31 {
32 child.SetProperty(prop.Name, ValueFromProperty(o, prop)); 32 using (var tmp = ValueFromProperty(o, prop))
33 {
34 child.SetProperty(prop.Name, tmp);
35 }
33 } 36 }
34 } 37 }
35 38
@@ -37,7 +40,7 @@ internal class ModelHelper
37 static internal void GetProperties<T>(T o, Efl.IModel child) 40 static internal void GetProperties<T>(T o, Efl.IModel child)
38 { 41 {
39 var properties = typeof(T).GetProperties(); 42 var properties = typeof(T).GetProperties();
40 foreach(var prop in properties) 43 foreach (var prop in properties)
41 { 44 {
42 using (var v = child.GetProperty(prop.Name)) 45 using (var v = child.GetProperty(prop.Name))
43 { 46 {
@@ -67,7 +70,7 @@ internal class ModelHelper
67/// </summary> 70/// </summary>
68/// <typeparam name="T">The enclosed C# model class with the properties to be added to the native model.</typeparam> 71/// <typeparam name="T">The enclosed C# model class with the properties to be added to the native model.</typeparam>
69[Efl.Eo.BindingEntity] 72[Efl.Eo.BindingEntity]
70public class UserModel<T> : Efl.MonoModelInternal, IDisposable 73public class UserModel<T> : Efl.MonoModelInternal
71{ 74{
72 /// <summary> 75 /// <summary>
73 /// Creates a new root model. 76 /// Creates a new root model.
@@ -79,18 +82,12 @@ public class UserModel<T> : Efl.MonoModelInternal, IDisposable
79 public UserModel (Efl.Object parent = null) : base(Efl.MonoModelInternal.efl_mono_model_internal_class_get(), parent) 82 public UserModel (Efl.Object parent = null) : base(Efl.MonoModelInternal.efl_mono_model_internal_class_get(), parent)
80 { 83 {
81 var properties = typeof(T).GetProperties(); 84 var properties = typeof(T).GetProperties();
82 foreach(var prop in properties) 85 foreach (var prop in properties)
83 { 86 {
84 AddProperty(prop.Name, Eina.ValueTypeBridge.GetManaged(prop.PropertyType)); 87 AddProperty(prop.Name, Eina.ValueTypeBridge.GetManaged(prop.PropertyType));
85 } 88 }
86 } 89 }
87 90
88 /// <summary>Disposes of this instance.</summary>
89 ~UserModel()
90 {
91 Dispose(false);
92 }
93
94 /// <summary>Adds a new child to the model wrapping the properties of <c>o</c> 91 /// <summary>Adds a new child to the model wrapping the properties of <c>o</c>
95 /// 92 ///
96 /// <para>Reflection is used to instantiate a new <see cref="Efl.IModel" />-based class for this child and 93 /// <para>Reflection is used to instantiate a new <see cref="Efl.IModel" />-based class for this child and