[return : MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Eina.FutureMarshaler))] internal static Eina.Future Cb(IntPtr cb_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Efl.Eo.MarshalEo <Efl.Eo.NonOwnTag>))] Efl.ViewModel view_model, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))] System.String property, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Eina.ValueMarshalerOwn))] Eina.Value value) { GCHandle handle = GCHandle.FromIntPtr(cb_data); EflViewModelPropertySet cb = (EflViewModelPropertySet)handle.Target; Eina.Future _ret_var = default(Eina.Future); try { _ret_var = cb(view_model, property, value); } catch (Exception e) { Eina.Log.Warning($"Callback error: {e.ToString()}"); Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION); } return(_ret_var); }
/// <summary>Add callbacks that will be triggered when someone ask for the specified property name when getting or setting a property. /// A get or set should at least be provided for this call to succeed. /// /// See <see cref="Efl.ViewModel.DelPropertyLogic"/></summary> /// <param name="property">The property to bind on to.</param> /// <param name="get">Define the get callback called when the <see cref="Efl.IModel.GetProperty"/> is called with the above property name.</param> /// <param name="set">Define the set callback called when the <see cref="Efl.IModel.GetProperty"/> is called with the above property name.</param> /// <param name="binded">Iterator of property name to bind with this defined property see <see cref="Efl.ViewModel.PropertyBind"/>.</param> virtual public Eina.Error AddPropertyLogic(System.String property, EflViewModelPropertyGet get, EflViewModelPropertySet set, Eina.Iterator <System.String> binded) { var _in_binded = binded.Handle; GCHandle get_handle = GCHandle.Alloc(get); GCHandle set_handle = GCHandle.Alloc(set); var _ret_var = Efl.ViewModel.NativeMethods.efl_view_model_property_logic_add_ptr.Value.Delegate((inherited ? Efl.Eo.Globals.efl_super(this.NativeHandle, this.NativeClass) : this.NativeHandle), property, GCHandle.ToIntPtr(get_handle), EflViewModelPropertyGetWrapper.Cb, Efl.Eo.Globals.free_gchandle, GCHandle.ToIntPtr(set_handle), EflViewModelPropertySetWrapper.Cb, Efl.Eo.Globals.free_gchandle, _in_binded); Eina.Error.RaiseIfUnhandledException(); return(_ret_var); }