{
add
{
- // Restricted to only one listener
if (_accessibilityManagerFocusedViewActivatedEventHandler == null)
{
- _accessibilityManagerFocusedViewActivatedEventCallbackDelegate = new FocusedViewActivatedEventCallbackDelegate(OnFocusedViewActivated);
- this.FocusedViewActivatedSignal().Connect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate);
+ _accessibilityManagerFocusedViewActivatedEventCallbackDelegate = OnFocusedViewActivated;
+ var signal = FocusedViewActivatedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Connect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate);
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
-
_accessibilityManagerFocusedViewActivatedEventHandler += value;
}
-
remove
{
_accessibilityManagerFocusedViewActivatedEventHandler -= value;
-
- if (_accessibilityManagerFocusedViewActivatedEventHandler == null && FocusedViewActivatedSignal().Empty() == false)
+ if (_accessibilityManagerFocusedViewActivatedEventHandler == null && _accessibilityManagerFocusedViewActivatedEventCallbackDelegate != null)
{
- this.FocusedViewActivatedSignal().Disconnect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate);
+ var signal = FocusedViewActivatedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate);
+ _accessibilityManagerFocusedViewActivatedEventCallbackDelegate = null;
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
private AnimationFinishedEventCallbackType _animationFinishedEventCallback;
private System.IntPtr _finishedCallbackOfNative;
+ private bool isFinishedSignalConnected = false;
private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback;
_animationFinishedEventCallback = OnFinished;
_finishedCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_animationFinishedEventCallback);
+ isFinishedSignalConnected = false;
}
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
{
add
{
- if (_animationFinishedEventHandler == null && disposed == false)
+ if (_animationFinishedEventHandler == null && disposed == false && isFinishedSignalConnected == false)
{
- FinishedSignal().Connect(_finishedCallbackOfNative);
+ var signal = FinishedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Connect(_finishedCallbackOfNative);
+ signal?.Dispose();
+ isFinishedSignalConnected = true;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_animationFinishedEventHandler += value;
}
remove
{
_animationFinishedEventHandler -= value;
-
- if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false)
+ if (_animationFinishedEventHandler == null && isFinishedSignalConnected)
{
- FinishedSignal().Disconnect(_finishedCallbackOfNative);
+ var signal = FinishedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_finishedCallbackOfNative);
+ signal?.Dispose();
+ isFinishedSignalConnected = false;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
return;
}
- if (_animationFinishedEventHandler != null)
+ if (_animationFinishedEventHandler != null && isFinishedSignalConnected)
{
- FinishedSignal().Disconnect(_finishedCallbackOfNative);
+ var signal = FinishedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_finishedCallbackOfNative);
+ signal?.Dispose();
+ isFinishedSignalConnected = false;
_animationFinishedEventHandler = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_animationProgressReachedEventCallback != null)
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
- if(swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
+ if (swigCPtr.Handle == IntPtr.Zero || this.HasBody() == false)
{
Tizen.Log.Fatal("NUI", $"[ERROR] Animation ReleaseSwigCPtr()! IntPtr=0x{swigCPtr.Handle:X} HasBody={this.HasBody()}");
return;
{
_keyCallback = OnKeyEvent;
var signal = KeyEventSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Connect(_keyCallback);
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_keyEventHandler += value;
}
remove
{
_keyEventHandler -= value;
- if (_keyEventHandler == null)
+ if (_keyEventHandler == null && _keyCallback != null)
{
var signal = KeyEventSignal();
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(_keyCallback);
- _keyCallback = null;
- }
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_keyCallback);
+ _keyCallback = null;
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
{
_touchDataCallback = OnTouch;
var signal = TouchSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Connect(_touchDataCallback);
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_touchDataEventHandler += value;
}
remove
{
_touchDataEventHandler -= value;
- if (_touchDataEventHandler == null)
+ if (_touchDataEventHandler == null && _touchDataCallback != null)
{
var signal = TouchSignal();
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(_touchDataCallback);
- _touchDataCallback = null;
- }
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_touchDataCallback);
+ _touchDataCallback = null;
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
{
_offWindowEventCallback = OffWindow;
var signal = OffWindowSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Connect(_offWindowEventCallback);
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_offWindowEventHandler += value;
}
remove
{
_offWindowEventHandler -= value;
- if (_offWindowEventHandler == null)
+ if (_offWindowEventHandler == null && _offWindowEventCallback != null)
{
var signal = OffWindowSignal();
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(_offWindowEventCallback);
- _offWindowEventCallback = null;
- }
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_offWindowEventCallback);
+ _offWindowEventCallback = null;
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
NUILog.Error("implicit disposed(unreachable)! just return here!");
return true;
}
-
+
if (touchData == global::System.IntPtr.Zero)
{
NUILog.Error("touchData should not be null!");
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
-
+
DisConnectFromSignals();
foreach (View view in Children)
if (_offWindowEventCallback != null)
{
ViewSignal signal = new ViewSignal(Interop.ActorSignal.Actor_OffSceneSignal(GetBaseHandleCPtrHandleRef), false);
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Disconnect(_offWindowEventCallback);
signal?.Dispose();
_offWindowEventCallback = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_onWindowEventCallback != null)
if (_touchDataCallback != null)
{
TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(GetBaseHandleCPtrHandleRef), false);
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Disconnect(_touchDataCallback);
signal?.Dispose();
_touchDataCallback = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_ResourcesLoadedCallback != null)
if (_keyCallback != null)
{
ControlKeySignal signal = new ControlKeySignal(Interop.ViewSignal.View_KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Disconnect(_keyCallback);
signal?.Dispose();
_keyCallback = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_keyInputFocusLostCallback != null)
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// <since_tizen> 4 </since_tizen>
public class PropertyNotification : BaseHandle
{
+ #region Fields
+ private DaliEventHandler<object, NotifyEventArgs> notifiedEventHandler;
+ private NotifyEventCallbackDelegate notifySignalCallback;
+ #endregion //#region Fields
- private DaliEventHandler<object, NotifyEventArgs> _propertyNotificationNotifyEventHandler;
- private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate;
-
+ #region Constructors
/// <summary>
/// Create a instance of PropertyNotification.
/// </summary>
internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.PropertyNotification.PropertyNotification_SWIGUpcast(cPtr), cMemoryOwn)
{
}
+ #endregion //#region Constructors
+
+ #region Distructors
+ /// <summary>
+ /// you can override it to clean-up your own resources.
+ /// </summary>
+ /// <param name="type">DisposeTypes</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (disposed)
+ {
+ return;
+ }
+
+ if (notifySignalCallback != null)
+ {
+ var signal = NotifySignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(notifySignalCallback);
+ notifySignalCallback = null;
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ if (type == DisposeTypes.Explicit)
+ {
+ //Called by User
+ //Release your own managed resources here.
+ //You should release all of your own disposable objects here.
+ }
+ //Release your own unmanaged resources here.
+ //You should not access any managed member here except static instance.
+ //because the execution order of Finalizes is non-deterministic.
+
+ base.Dispose(type);
+ }
+ // This will not be public opened.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
+ {
+ Interop.PropertyNotification.delete_PropertyNotification(swigCPtr);
+ }
+ #endregion //#region Distructors
+
+ #region Delegates
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification);
+ #endregion //#region Delegates
+ #region Events
///<summary>
/// Event for Notified signal which can be used to subscribe/unsubscribe the event handler
/// Notified signal is emitted when the notification upon a condition of the property being met, has occurred.
{
add
{
- lock (this)
+ if (notifiedEventHandler == null)
{
- // Restricted to only one listener
- if (_propertyNotificationNotifyEventHandler == null)
- {
- _propertyNotificationNotifyEventHandler += value;
-
- _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify);
- this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate);
- }
+ notifySignalCallback = OnPropertyNotificationNotify;
+ var signal = NotifySignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Connect(notifySignalCallback);
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+ notifiedEventHandler += value;
}
-
remove
{
- lock (this)
+ notifiedEventHandler -= value;
+ if (notifiedEventHandler == null && notifySignalCallback != null)
{
- if (_propertyNotificationNotifyEventHandler != null)
- {
- this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate);
- }
+ var signal = NotifySignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(notifySignalCallback);
+ notifySignalCallback = null;
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+ }
+ }
- _propertyNotificationNotifyEventHandler -= value;
+ ///<summary>
+ /// Event arguments that passed via Notify signal
+ ///</summary>
+ /// <since_tizen> 3 </since_tizen>
+ public class NotifyEventArgs : EventArgs
+ {
+ private PropertyNotification propertyNotification;
+
+ ///<summary>
+ /// PropertyNotification - is the PropertyNotification handle that has the notification properties.
+ ///</summary>
+ /// <since_tizen> 3 </since_tizen>
+ public PropertyNotification PropertyNotification
+ {
+ get
+ {
+ return propertyNotification;
+ }
+ set
+ {
+ propertyNotification = value;
}
}
}
+ #endregion //#region Events
+ #region Enums
/// <summary>
/// Enumeration for description of how to check condition.
/// </summary>
/// <since_tizen> 3 </since_tizen>
NotifyOnChanged
}
+ #endregion //#region Enums
- /// <summary>
- /// Get property notification from Intptr.<br/>
- /// This should be internal, please do not use.
- /// </summary>
- /// <param name="cPtr">An object of IntPtr type.</param>
- /// <returns>An object of the PropertyNotification type.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API6, Will be removed in API9, " +
- "Please use Notified event instead!" +
- "IntPtr(native integer pointer) is supposed to be not used in Application!")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static PropertyNotification GetPropertyNotificationFromPtr(global::System.IntPtr cPtr)
- {
- PropertyNotification ret = new PropertyNotification(cPtr, false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
+ #region Methods
/// <summary>
/// Downcast a PropertyNotification instance.
/// </summary>
}
/// <summary>
- /// Assign.
- /// </summary>
- /// <param name="rhs">A reference to the copied handle.</param>
- /// <returns>A reference to this.</returns>
- /// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API6, Will be removed in API9, " +
- "Please use PropertyNotification() constructor instead!")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public PropertyNotification Assign(PropertyNotification rhs)
- {
- PropertyNotification ret = new PropertyNotification(Interop.PropertyNotification.PropertyNotification_Assign(swigCPtr, PropertyNotification.getCPtr(rhs)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
- }
-
- /// <summary>
/// Gets the condition of this notification.
/// </summary>
/// <returns>The condition is returned.</returns>
}
/// <summary>
+ /// Get property notification from Intptr.<br/>
+ /// This should be internal, please do not use.
+ /// </summary>
+ /// <param name="cPtr">An object of IntPtr type.</param>
+ /// <returns>An object of the PropertyNotification type.</returns>
+ /// <since_tizen> 4 </since_tizen>
+ [Obsolete("Deprecated in API6, Will be removed in API9, " +
+ "Please use Notified event instead!" +
+ "IntPtr(native integer pointer) is supposed to be not used in Application!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static PropertyNotification GetPropertyNotificationFromPtr(global::System.IntPtr cPtr)
+ {
+ PropertyNotification ret = new PropertyNotification(cPtr, false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
+ /// Assign.
+ /// </summary>
+ /// <param name="rhs">A reference to the copied handle.</param>
+ /// <returns>A reference to this.</returns>
+ /// <since_tizen> 4 </since_tizen>
+ [Obsolete("Deprecated in API6, Will be removed in API9, " +
+ "Please use PropertyNotification() constructor instead!")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public PropertyNotification Assign(PropertyNotification rhs)
+ {
+ PropertyNotification ret = new PropertyNotification(Interop.PropertyNotification.PropertyNotification_Assign(swigCPtr, PropertyNotification.getCPtr(rhs)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
+
+ /// <summary>
/// Connects to this signal to be notified when the notification has occurred.
/// </summary>
/// <returns>A signal object to Connect() with</returns>
/// <since_tizen> 4 </since_tizen>
- [Obsolete("Deprecated in API6, Will be removed in API9, " +
+ [Obsolete("Deprecated in API6, Will be removed in API9, " +
"Please use Notified event instead!")]
[EditorBrowsable(EditorBrowsableState.Never)]
public PropertyNotifySignal NotifySignal()
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- /// This will not be public opened.
- [EditorBrowsable(EditorBrowsableState.Never)]
- protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
- {
- Interop.PropertyNotification.delete_PropertyNotification(swigCPtr);
- }
-
// Callback for PropertyNotification NotifySignal
private void OnPropertyNotificationNotify(IntPtr propertyNotification)
{
NotifyEventArgs e = new NotifyEventArgs();
e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification);
- if (_propertyNotificationNotifyEventHandler != null)
+ if (notifiedEventHandler != null)
{
//here we send all data to user event handlers
- _propertyNotificationNotifyEventHandler(this, e);
- }
- }
-
- ///<summary>
- /// Event arguments that passed via Notify signal
- ///</summary>
- /// <since_tizen> 3 </since_tizen>
- public class NotifyEventArgs : EventArgs
- {
- private PropertyNotification _propertyNotification;
-
- ///<summary>
- /// PropertyNotification - is the PropertyNotification handle that has the notification properties.
- ///</summary>
- /// <since_tizen> 3 </since_tizen>
- public PropertyNotification PropertyNotification
- {
- get
- {
- return _propertyNotification;
- }
- set
- {
- _propertyNotification = value;
- }
+ notifiedEventHandler(this, e);
}
}
+ #endregion //#region Methods
}
}
{
if (_styleManagerStyleChangedEventHandler == null)
{
- _styleManagerStyleChangedCallbackDelegate = (OnStyleChanged);
- StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate);
+ _styleManagerStyleChangedCallbackDelegate = OnStyleChanged;
+ var signal = StyleChangedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Connect(_styleManagerStyleChangedCallbackDelegate);
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_styleManagerStyleChangedEventHandler += value;
}
remove
{
_styleManagerStyleChangedEventHandler -= value;
- if (_styleManagerStyleChangedEventHandler == null && StyleChangedSignal().Empty() == false)
+ if (_styleManagerStyleChangedEventHandler == null && _styleManagerStyleChangedCallbackDelegate != null)
{
- StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate);
+ var signal = StyleChangedSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_styleManagerStyleChangedCallbackDelegate);
+ _styleManagerStyleChangedCallbackDelegate = null;
+ signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
private TickCallbackDelegate _timerTickCallbackDelegate;
private System.IntPtr _timerTickCallbackOfNative;
+ private bool isTickSignalConnected = false;
/// <summary>
/// Creates a tick timer that emits periodic signal.
internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.Timer.Timer_SWIGUpcast(cPtr), cMemoryOwn)
{
-
_timerTickCallbackDelegate = OnTick;
_timerTickCallbackOfNative = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate<System.Delegate>(_timerTickCallbackDelegate);
-
+ isTickSignalConnected = false;
NUILog.Debug($"(0x{swigCPtr.Handle:X})Timer() contructor!");
}
{
add
{
- if (_timerTickEventHandler == null && disposed == false)
+ if (_timerTickEventHandler == null && disposed == false && isTickSignalConnected == false)
{
- TickSignal().Connect(_timerTickCallbackOfNative);
+ var signal = TickSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Connect(_timerTickCallbackOfNative);
+ signal?.Dispose();
+ isTickSignalConnected = true;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_timerTickEventHandler += value;
}
remove
{
_timerTickEventHandler -= value;
- if (_timerTickEventHandler == null && TickSignal().Empty() == false)
+ if (_timerTickEventHandler == null && isTickSignalConnected)
{
- TickSignal().Disconnect(_timerTickCallbackOfNative);
+ var signal = TickSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_timerTickCallbackOfNative);
+ signal?.Dispose();
+ isTickSignalConnected = false;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
internal uint GetInterval()
{
- if(swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
+ if (swigCPtr.Handle == global::System.IntPtr.Zero || disposed)
{
NUILog.Error("[ERR] already disposed! can not get this done! just return here! please make sure that the handle gets free when using explicit Dispose()! For example, timer.Dispose(); timer = null; this must be done!");
return 0;
{
NUILog.Debug($"(0x{swigCPtr.Handle:X}) Timer.Dispose(type={type}, disposed={disposed})");
- if (this != null && _timerTickCallbackDelegate != null)
+ if (this != null && _timerTickCallbackDelegate != null && isTickSignalConnected)
{
- TickSignal().Disconnect(_timerTickCallbackOfNative);
+ var signal = TickSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_timerTickCallbackOfNative);
+ signal?.Dispose();
+ isTickSignalConnected = false;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (disposed)
{
_rootLayerTouchDataCallback = OnWindowTouch;
var signal = TouchDataSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Connect(_rootLayerTouchDataCallback);
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_rootLayerTouchDataEventHandler += value;
}
remove
{
_rootLayerTouchDataEventHandler -= value;
- if (_rootLayerTouchDataEventHandler == null)
+ if (_rootLayerTouchDataEventHandler == null && _rootLayerTouchDataCallback != null)
{
var signal = TouchDataSignal();
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(_rootLayerTouchDataCallback);
- _rootLayerTouchDataCallback = null;
- }
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_rootLayerTouchDataCallback);
+ _rootLayerTouchDataCallback = null;
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
{
_stageKeyCallbackDelegate = OnStageKey;
var signal = KeyEventSignal();
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Connect(_stageKeyCallbackDelegate);
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
_stageKeyHandler += value;
}
remove
{
_stageKeyHandler -= value;
- if (_stageKeyHandler == null)
+ if (_stageKeyHandler == null && _stageKeyCallbackDelegate != null)
{
var signal = KeyEventSignal();
- if (signal?.Empty() == false)
- {
- signal?.Disconnect(_stageKeyCallbackDelegate);
- _stageKeyCallbackDelegate = null;
- }
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
+ signal?.Disconnect(_stageKeyCallbackDelegate);
+ _stageKeyCallbackDelegate = null;
signal?.Dispose();
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
if (_rootLayerTouchDataCallback != null)
{
TouchDataSignal signal = new TouchDataSignal(Interop.ActorSignal.Actor_TouchSignal(Layer.getCPtr(GetRootLayer())), false);
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Disconnect(_rootLayerTouchDataCallback);
signal?.Dispose();
_rootLayerTouchDataCallback = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_wheelEventCallback != null)
if (_stageKeyCallbackDelegate != null)
{
KeyEventSignal signal = new KeyEventSignal(Interop.Window.KeyEventSignal(GetBaseHandleCPtrHandleRef), false);
+ if (signal?.SwigCPtr.Handle == IntPtr.Zero) { signal = null; }
signal?.Disconnect(_stageKeyCallbackDelegate);
signal?.Dispose();
_stageKeyCallbackDelegate = null;
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
if (_stageEventProcessingFinishedEventCallbackDelegate != null)