[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate void LayoutDirectionChangedEventCallbackType(IntPtr data, ViewLayoutDirectionType type);
- private ViewSignal offWindowSignal;
- private WheelSignal wheelEventSignal;
- private ControlKeySignal keyEventSignal;
- private TouchDataSignal interceptTouchSignal;
- private TouchDataSignal touchSignal;
- private HoverSignal hoveredSignal;
- private ViewVisibilityChangedSignal visibilityChangedSignal;
- private KeyInputFocusSignal keyInputFocusGainedSignal;
- private KeyInputFocusSignal keyInputFocusLostSignal;
- private ViewSignal onRelayoutSignal;
- private ViewSignal onWindowSignal;
- private ViewLayoutDirectionChangedSignal layoutDirectionChangedSignal;
- private ViewSignal resourcesLoadedSignal;
- private ViewSignal backgroundResourcesLoadedSignal;
- private ViewSignal onWindowSendSignal;
-
/// <summary>
/// Event when a child is removed.
/// </summary>
if (keyInputFocusGainedEventHandler == null)
{
keyInputFocusGainedCallback = OnKeyInputFocusGained;
- keyInputFocusGainedSignal = this.KeyInputFocusGainedSignal();
- keyInputFocusGainedSignal?.Connect(keyInputFocusGainedCallback);
+ this.KeyInputFocusGainedSignal().Connect(keyInputFocusGainedCallback);
}
keyInputFocusGainedEventHandler += value;
{
keyInputFocusGainedEventHandler -= value;
- if (keyInputFocusGainedEventHandler == null && keyInputFocusGainedSignal?.Empty() == false)
+ if (keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false)
{
- keyInputFocusGainedSignal?.Disconnect(keyInputFocusGainedCallback);
- keyInputFocusGainedSignal?.Dispose();
- keyInputFocusGainedSignal = null;
- keyInputFocusGainedCallback = null;
+ this.KeyInputFocusGainedSignal().Disconnect(keyInputFocusGainedCallback);
}
}
}
if (keyInputFocusLostEventHandler == null)
{
keyInputFocusLostCallback = OnKeyInputFocusLost;
- keyInputFocusLostSignal = this.KeyInputFocusLostSignal();
- keyInputFocusLostSignal?.Connect(keyInputFocusLostCallback);
+ this.KeyInputFocusLostSignal().Connect(keyInputFocusLostCallback);
}
keyInputFocusLostEventHandler += value;
{
keyInputFocusLostEventHandler -= value;
- if (keyInputFocusLostEventHandler == null && keyInputFocusLostSignal?.Empty() == false)
+ if (keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false)
{
- keyInputFocusLostSignal?.Disconnect(keyInputFocusLostCallback);
- keyInputFocusLostSignal?.Dispose();
- keyInputFocusLostSignal = null;
- keyInputFocusLostCallback = null;
+ this.KeyInputFocusLostSignal().Disconnect(keyInputFocusLostCallback);
}
}
}
if (keyEventHandler == null)
{
keyCallback = OnKeyEvent;
- keyEventSignal = this.KeyEventSignal();
- keyEventSignal?.Connect(keyCallback);
+ this.KeyEventSignal().Connect(keyCallback);
}
keyEventHandler += value;
{
keyEventHandler -= value;
- if (keyEventHandler == null && keyEventSignal?.Empty() == false)
+ if (keyEventHandler == null && KeyEventSignal().Empty() == false)
{
- keyEventSignal?.Disconnect(keyCallback);
- keyEventSignal?.Dispose();
- keyEventSignal = null;
- keyCallback = null;
+ this.KeyEventSignal().Disconnect(keyCallback);
}
}
}
if (onRelayoutEventHandler == null)
{
onRelayoutEventCallback = OnRelayout;
- onRelayoutSignal = this.OnRelayoutSignal();
- onRelayoutSignal?.Connect(onRelayoutEventCallback);
+ this.OnRelayoutSignal().Connect(onRelayoutEventCallback);
}
onRelayoutEventHandler += value;
{
onRelayoutEventHandler -= value;
- if (onRelayoutEventHandler == null && onRelayoutSignal?.Empty() == false)
+ if (onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false)
{
- onRelayoutSignal?.Disconnect(onRelayoutEventCallback);
- onRelayoutSignal?.Dispose();
- onRelayoutSignal = null;
+ this.OnRelayoutSignal().Disconnect(onRelayoutEventCallback);
onRelayoutEventCallback = null;
}
+
}
}
if (interceptTouchDataEventHandler == null)
{
interceptTouchDataCallback = OnInterceptTouch;
- interceptTouchSignal = this.InterceptTouchSignal();
- interceptTouchSignal?.Connect(interceptTouchDataCallback);
+ this.InterceptTouchSignal().Connect(interceptTouchDataCallback);
}
interceptTouchDataEventHandler += value;
{
interceptTouchDataEventHandler -= value;
- if (interceptTouchDataEventHandler == null && interceptTouchSignal?.Empty() == false)
+ if (interceptTouchDataEventHandler == null && InterceptTouchSignal().Empty() == false)
{
- interceptTouchSignal?.Disconnect(interceptTouchDataCallback);
- interceptTouchSignal?.Dispose();
- interceptTouchSignal = null;
- interceptTouchDataCallback = null;
+ this.InterceptTouchSignal().Disconnect(interceptTouchDataCallback);
}
}
}
if (touchDataEventHandler == null)
{
touchDataCallback = OnTouch;
- touchSignal = this.TouchSignal();
- touchSignal?.Connect(touchDataCallback);
+ this.TouchSignal().Connect(touchDataCallback);
}
touchDataEventHandler += value;
{
touchDataEventHandler -= value;
- if (touchDataEventHandler == null && touchSignal?.Empty() == false)
+ if (touchDataEventHandler == null && TouchSignal().Empty() == false)
{
- touchSignal?.Disconnect(touchDataCallback);
- touchSignal?.Dispose();
- touchSignal = null;
- touchDataCallback = null;
+ this.TouchSignal().Disconnect(touchDataCallback);
}
}
}
if (hoverEventHandler == null)
{
hoverEventCallback = OnHoverEvent;
- hoveredSignal = this.HoveredSignal();
- hoveredSignal?.Connect(hoverEventCallback);
+ this.HoveredSignal().Connect(hoverEventCallback);
}
hoverEventHandler += value;
{
hoverEventHandler -= value;
- if (hoverEventHandler == null && hoveredSignal?.Empty() == false)
+ if (hoverEventHandler == null && HoveredSignal().Empty() == false)
{
- hoveredSignal?.Disconnect(hoverEventCallback);
- hoveredSignal?.Dispose();
- hoveredSignal = null;
- hoverEventCallback = null;
+ this.HoveredSignal().Disconnect(hoverEventCallback);
}
+
}
}
if (wheelEventHandler == null)
{
wheelEventCallback = OnWheelEvent;
- wheelEventSignal = this.WheelEventSignal();
- wheelEventSignal?.Connect(wheelEventCallback);
+ this.WheelEventSignal().Connect(wheelEventCallback);
}
-
wheelEventHandler += value;
if (WindowWheelEventHandler == null)
remove
{
wheelEventHandler -= value;
-
- if (wheelEventHandler == null && wheelEventSignal?.Empty() == false)
+ if (wheelEventHandler == null && WheelEventSignal().Empty() == false)
{
- wheelEventSignal?.Disconnect(wheelEventCallback);
- wheelEventSignal?.Dispose();
- wheelEventSignal = null;
- wheelEventCallback = null;
+ this.WheelEventSignal().Disconnect(wheelEventCallback);
}
WindowWheelEventHandler -= value;
if (onWindowEventHandler == null)
{
onWindowEventCallback = OnWindow;
- onWindowSignal = this.OnWindowSignal();
- onWindowSignal?.Connect(onWindowEventCallback);
+ this.OnWindowSignal().Connect(onWindowEventCallback);
}
onWindowEventHandler += value;
{
onWindowEventHandler -= value;
- if (onWindowEventHandler == null && onWindowSignal?.Empty() == false)
+ if (onWindowEventHandler == null && OnWindowSignal().Empty() == false)
{
- onWindowSignal?.Disconnect(onWindowEventCallback);
- onWindowSignal?.Dispose();
- onWindowSignal = null;
+ this.OnWindowSignal().Disconnect(onWindowEventCallback);
onWindowEventCallback = null;
}
}
if (offWindowEventHandler == null)
{
offWindowEventCallback = OffWindow;
- offWindowSignal = this.OffWindowSignal();
- offWindowSignal?.Connect(offWindowEventCallback);
+ this.OffWindowSignal().Connect(offWindowEventCallback);
}
offWindowEventHandler += value;
{
offWindowEventHandler -= value;
- if (offWindowEventHandler == null && offWindowSignal?.Empty() == false)
+ if (offWindowEventHandler == null && OffWindowSignal().Empty() == false)
{
- offWindowSignal?.Disconnect(offWindowEventCallback);
- offWindowSignal.Dispose();
- offWindowSignal = null;
+ this.OffWindowSignal().Disconnect(offWindowEventCallback);
offWindowEventCallback = null;
}
}
if (visibilityChangedEventHandler == null)
{
visibilityChangedEventCallback = OnVisibilityChanged;
- visibilityChangedSignal = this.VisibilityChangedSignal(this);
- visibilityChangedSignal?.Connect(visibilityChangedEventCallback);
+ VisibilityChangedSignal(this).Connect(visibilityChangedEventCallback);
}
visibilityChangedEventHandler += value;
{
visibilityChangedEventHandler -= value;
- if (visibilityChangedEventHandler == null && visibilityChangedSignal?.Empty() == false)
+ if (visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false)
{
- visibilityChangedSignal?.Disconnect(visibilityChangedEventCallback);
- visibilityChangedSignal?.Dispose();
- visibilityChangedSignal = null;
- visibilityChangedEventCallback = null;
+ VisibilityChangedSignal(this).Disconnect(visibilityChangedEventCallback);
}
}
}
if (layoutDirectionChangedEventHandler == null)
{
layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
- layoutDirectionChangedSignal = this.LayoutDirectionChangedSignal(this);
- layoutDirectionChangedSignal?.Connect(layoutDirectionChangedEventCallback);
+ LayoutDirectionChangedSignal(this).Connect(layoutDirectionChangedEventCallback);
}
layoutDirectionChangedEventHandler += value;
{
layoutDirectionChangedEventHandler -= value;
- if (layoutDirectionChangedEventHandler == null && layoutDirectionChangedSignal?.Empty() == false)
+ if (layoutDirectionChangedEventHandler == null && LayoutDirectionChangedSignal(this).Empty() == false)
{
- layoutDirectionChangedSignal?.Disconnect(layoutDirectionChangedEventCallback);
- layoutDirectionChangedSignal?.Dispose();
- layoutDirectionChangedSignal = null;
- layoutDirectionChangedEventCallback = null;
+ LayoutDirectionChangedSignal(this).Disconnect(layoutDirectionChangedEventCallback);
}
}
}
if (resourcesLoadedEventHandler == null)
{
ResourcesLoadedCallback = OnResourcesLoaded;
- resourcesLoadedSignal = this.ResourcesLoadedSignal();
- resourcesLoadedSignal?.Connect(ResourcesLoadedCallback);
+ this.ResourcesLoadedSignal().Connect(ResourcesLoadedCallback);
}
resourcesLoadedEventHandler += value;
{
resourcesLoadedEventHandler -= value;
- if (resourcesLoadedEventHandler == null && resourcesLoadedSignal?.Empty() == false)
+ if (resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
{
- resourcesLoadedSignal?.Disconnect(ResourcesLoadedCallback);
- resourcesLoadedSignal?.Dispose();
- resourcesLoadedSignal = null;
+ this.ResourcesLoadedSignal().Disconnect(ResourcesLoadedCallback);
ResourcesLoadedCallback = null;
}
}
if (backgroundResourceLoadedEventHandler == null)
{
backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
- backgroundResourcesLoadedSignal = this.ResourcesLoadedSignal();
- backgroundResourcesLoadedSignal?.Connect(backgroundResourceLoadedCallback);
+ this.ResourcesLoadedSignal().Connect(backgroundResourceLoadedCallback);
}
backgroundResourceLoadedEventHandler += value;
{
backgroundResourceLoadedEventHandler -= value;
- if (backgroundResourceLoadedEventHandler == null && backgroundResourcesLoadedSignal?.Empty() == false)
+ if (backgroundResourceLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
{
- backgroundResourcesLoadedSignal?.Disconnect(backgroundResourceLoadedCallback);
- backgroundResourcesLoadedSignal?.Dispose();
- backgroundResourcesLoadedSignal = null;
+ this.ResourcesLoadedSignal().Disconnect(backgroundResourceLoadedCallback);
backgroundResourceLoadedCallback = null;
}
}
}
else if (width != null && height == null)
{
- Vector2 minSize = this.GetMinimumSize();
- MinimumSize = new Size2D((int)width, (int)(minSize.Height));
- minSize.Dispose();
+ MinimumSize = new Size2D((int)width, (int)this.GetMinimumSize().Height);
}
else if (width == null && height != null)
{
- Vector2 minSize = this.GetMinimumSize();
- MinimumSize = new Size2D((int)(minSize.Width), (int)height);
- minSize.Dispose();
+ MinimumSize = new Size2D((int)this.GetMinimumSize().Width, (int)height);
}
else
{
}
else if (width != null && height == null)
{
- Vector2 maxSize = this.GetMaximumSize();
- MaximumSize = new Size2D((int)width, (int)(maxSize.Height));
- maxSize.Dispose();
+ MaximumSize = new Size2D((int)width, (int)this.GetMaximumSize().Height);
}
else if (width == null && height != null)
{
- Vector2 maxSize = this.GetMaximumSize();
- MaximumSize = new Size2D((int)(maxSize.Width), (int)height);
- maxSize.Dispose();
+ MaximumSize = new Size2D((int)this.GetMaximumSize().Width, (int)height);
}
else
{
//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();
+ if (this != null)
+ {
+ DisConnectFromSignals();
+ }
foreach (View view in Children)
{
if (onRelayoutEventCallback != null)
{
- onRelayoutSignal?.Disconnect(onRelayoutEventCallback);
- onRelayoutSignal?.Dispose();
- onRelayoutSignal = null;
+ ViewSignal signal = this.OnRelayoutSignal();
+ signal?.Disconnect(onRelayoutEventCallback);
+ signal?.Dispose();
onRelayoutEventCallback = null;
}
if (offWindowEventCallback != null)
{
- offWindowSignal?.Disconnect(offWindowEventCallback);
- offWindowSignal?.Dispose();
- offWindowSignal = null;
+ ViewSignal signal = this.OffWindowSignal();
+ signal?.Disconnect(offWindowEventCallback);
+ signal?.Dispose();
offWindowEventCallback = null;
}
if (onWindowEventCallback != null)
{
- onWindowSignal?.Disconnect(onWindowEventCallback);
- onWindowSignal?.Dispose();
- onWindowSignal = null;
+ ViewSignal signal = this.OnWindowSignal();
+ signal?.Disconnect(onWindowEventCallback);
+ signal?.Dispose();
onWindowEventCallback = null;
}
if (wheelEventCallback != null)
{
- wheelEventSignal?.Disconnect(wheelEventCallback);
- wheelEventSignal?.Dispose();
- wheelEventSignal = null;
- wheelEventCallback = null;
+ WheelSignal signal = this.WheelEventSignal();
+ signal?.Disconnect(wheelEventCallback);
+ signal?.Dispose();
}
if (WindowWheelEventHandler != null)
if (hoverEventCallback != null)
{
- hoveredSignal?.Disconnect(hoverEventCallback);
- hoveredSignal?.Dispose();
- hoveredSignal = null;
- hoverEventCallback = null;
+ HoverSignal signal = this.HoveredSignal();
+ signal?.Disconnect(hoverEventCallback);
+ signal?.Dispose();
}
if (interceptTouchDataCallback != null)
{
- interceptTouchSignal?.Disconnect(interceptTouchDataCallback);
- interceptTouchSignal?.Dispose();
- interceptTouchSignal = null;
- interceptTouchDataCallback = null;
+ TouchDataSignal signal = this.InterceptTouchSignal();
+ signal?.Disconnect(interceptTouchDataCallback);
+ signal?.Dispose();
}
if (touchDataCallback != null)
{
- touchSignal?.Disconnect(touchDataCallback);
- touchSignal?.Dispose();
- touchSignal = null;
- touchDataCallback = null;
+ TouchDataSignal signal = this.TouchSignal();
+ signal?.Disconnect(touchDataCallback);
+ signal?.Dispose();
}
if (ResourcesLoadedCallback != null)
{
- resourcesLoadedSignal?.Disconnect(ResourcesLoadedCallback);
- resourcesLoadedSignal?.Dispose();
- resourcesLoadedSignal = null;
+ ViewSignal signal = this.ResourcesLoadedSignal();
+ signal?.Disconnect(ResourcesLoadedCallback);
+ signal?.Dispose();
ResourcesLoadedCallback = null;
}
if (keyCallback != null)
{
- keyEventSignal?.Disconnect(keyCallback);
- keyEventSignal?.Dispose();
- keyEventSignal = null;
- keyCallback = null;
+ ControlKeySignal signal = this.KeyEventSignal();
+ signal?.Disconnect(keyCallback);
+ signal?.Dispose();
}
if (keyInputFocusLostCallback != null)
{
- keyInputFocusLostSignal?.Disconnect(keyInputFocusLostCallback);
- keyInputFocusLostSignal?.Dispose();
- keyInputFocusLostSignal = null;
- keyInputFocusLostCallback = null;
+ KeyInputFocusSignal signal = this.KeyInputFocusLostSignal();
+ signal?.Disconnect(keyInputFocusLostCallback);
+ signal?.Dispose();
}
if (keyInputFocusGainedCallback != null)
{
- keyInputFocusGainedSignal?.Disconnect(keyInputFocusGainedCallback);
- keyInputFocusGainedSignal?.Dispose();
- keyInputFocusGainedSignal = null;
- keyInputFocusGainedCallback = null;
+ KeyInputFocusSignal signal = this.KeyInputFocusGainedSignal();
+ signal?.Disconnect(keyInputFocusGainedCallback);
+ signal?.Dispose();
}
if (backgroundResourceLoadedCallback != null)
{
- backgroundResourcesLoadedSignal?.Disconnect(backgroundResourceLoadedCallback);
- backgroundResourcesLoadedSignal?.Dispose();
- backgroundResourcesLoadedSignal = null;
+ ViewSignal signal = this.ResourcesLoadedSignal();
+ signal?.Disconnect(backgroundResourceLoadedCallback);
+ signal?.Dispose();
backgroundResourceLoadedCallback = null;
}
if (onWindowSendEventCallback != null)
{
- onWindowSendSignal?.Disconnect(onWindowSendEventCallback);
- onWindowSendSignal?.Dispose();
- onWindowSendSignal = null;
+ ViewSignal signal = this.OnWindowSignal();
+ signal?.Disconnect(onWindowSendEventCallback);
+ signal?.Dispose();
onWindowSendEventCallback = null;
}
- if (visibilityChangedEventCallback != null)
- {
- visibilityChangedSignal?.Disconnect(visibilityChangedEventCallback);
- visibilityChangedSignal?.Dispose();
- visibilityChangedSignal = null;
- visibilityChangedEventCallback = null;
- }
-
- if (layoutDirectionChangedEventCallback != null)
- {
- layoutDirectionChangedSignal?.Disconnect(layoutDirectionChangedEventCallback);
- layoutDirectionChangedSignal?.Dispose();
- layoutDirectionChangedSignal = null;
- layoutDirectionChangedEventCallback = null;
- }
-
// BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
// Restore current CPtr.
SwigCPtr = currentCPtr;