[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;
- this.KeyInputFocusGainedSignal().Connect(keyInputFocusGainedCallback);
+ keyInputFocusGainedSignal = this.KeyInputFocusGainedSignal();
+ keyInputFocusGainedSignal?.Connect(keyInputFocusGainedCallback);
}
keyInputFocusGainedEventHandler += value;
{
keyInputFocusGainedEventHandler -= value;
- if (keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false)
+ if (keyInputFocusGainedEventHandler == null && keyInputFocusGainedSignal?.Empty() == false)
{
- this.KeyInputFocusGainedSignal().Disconnect(keyInputFocusGainedCallback);
+ keyInputFocusGainedSignal?.Disconnect(keyInputFocusGainedCallback);
+ keyInputFocusGainedSignal?.Dispose();
+ keyInputFocusGainedSignal = null;
+ keyInputFocusGainedCallback = null;
}
}
}
if (keyInputFocusLostEventHandler == null)
{
keyInputFocusLostCallback = OnKeyInputFocusLost;
- this.KeyInputFocusLostSignal().Connect(keyInputFocusLostCallback);
+ keyInputFocusLostSignal = this.KeyInputFocusLostSignal();
+ keyInputFocusLostSignal?.Connect(keyInputFocusLostCallback);
}
keyInputFocusLostEventHandler += value;
{
keyInputFocusLostEventHandler -= value;
- if (keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false)
+ if (keyInputFocusLostEventHandler == null && keyInputFocusLostSignal?.Empty() == false)
{
- this.KeyInputFocusLostSignal().Disconnect(keyInputFocusLostCallback);
+ keyInputFocusLostSignal?.Disconnect(keyInputFocusLostCallback);
+ keyInputFocusLostSignal?.Dispose();
+ keyInputFocusLostSignal = null;
+ keyInputFocusLostCallback = null;
}
}
}
if (keyEventHandler == null)
{
keyCallback = OnKeyEvent;
- this.KeyEventSignal().Connect(keyCallback);
+ keyEventSignal = this.KeyEventSignal();
+ keyEventSignal?.Connect(keyCallback);
}
keyEventHandler += value;
{
keyEventHandler -= value;
- if (keyEventHandler == null && KeyEventSignal().Empty() == false)
+ if (keyEventHandler == null && keyEventSignal?.Empty() == false)
{
- this.KeyEventSignal().Disconnect(keyCallback);
+ keyEventSignal?.Disconnect(keyCallback);
+ keyEventSignal?.Dispose();
+ keyEventSignal = null;
+ keyCallback = null;
}
}
}
if (onRelayoutEventHandler == null)
{
onRelayoutEventCallback = OnRelayout;
- this.OnRelayoutSignal().Connect(onRelayoutEventCallback);
+ onRelayoutSignal = this.OnRelayoutSignal();
+ onRelayoutSignal?.Connect(onRelayoutEventCallback);
}
onRelayoutEventHandler += value;
{
onRelayoutEventHandler -= value;
- if (onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false)
+ if (onRelayoutEventHandler == null && onRelayoutSignal?.Empty() == false)
{
- this.OnRelayoutSignal().Disconnect(onRelayoutEventCallback);
+ onRelayoutSignal?.Disconnect(onRelayoutEventCallback);
+ onRelayoutSignal?.Dispose();
+ onRelayoutSignal = null;
onRelayoutEventCallback = null;
}
-
}
}
if (interceptTouchDataEventHandler == null)
{
interceptTouchDataCallback = OnInterceptTouch;
- this.InterceptTouchSignal().Connect(interceptTouchDataCallback);
+ interceptTouchSignal = this.InterceptTouchSignal();
+ interceptTouchSignal?.Connect(interceptTouchDataCallback);
}
interceptTouchDataEventHandler += value;
{
interceptTouchDataEventHandler -= value;
- if (interceptTouchDataEventHandler == null && InterceptTouchSignal().Empty() == false)
+ if (interceptTouchDataEventHandler == null && interceptTouchSignal?.Empty() == false)
{
- this.InterceptTouchSignal().Disconnect(interceptTouchDataCallback);
+ interceptTouchSignal?.Disconnect(interceptTouchDataCallback);
+ interceptTouchSignal?.Dispose();
+ interceptTouchSignal = null;
+ interceptTouchDataCallback = null;
}
}
}
if (touchDataEventHandler == null)
{
touchDataCallback = OnTouch;
- this.TouchSignal().Connect(touchDataCallback);
+ touchSignal = this.TouchSignal();
+ touchSignal?.Connect(touchDataCallback);
}
touchDataEventHandler += value;
{
touchDataEventHandler -= value;
- if (touchDataEventHandler == null && TouchSignal().Empty() == false)
+ if (touchDataEventHandler == null && touchSignal?.Empty() == false)
{
- this.TouchSignal().Disconnect(touchDataCallback);
+ touchSignal?.Disconnect(touchDataCallback);
+ touchSignal?.Dispose();
+ touchSignal = null;
+ touchDataCallback = null;
}
}
}
if (hoverEventHandler == null)
{
hoverEventCallback = OnHoverEvent;
- this.HoveredSignal().Connect(hoverEventCallback);
+ hoveredSignal = this.HoveredSignal();
+ hoveredSignal?.Connect(hoverEventCallback);
}
hoverEventHandler += value;
{
hoverEventHandler -= value;
- if (hoverEventHandler == null && HoveredSignal().Empty() == false)
+ if (hoverEventHandler == null && hoveredSignal?.Empty() == false)
{
- this.HoveredSignal().Disconnect(hoverEventCallback);
+ hoveredSignal?.Disconnect(hoverEventCallback);
+ hoveredSignal?.Dispose();
+ hoveredSignal = null;
+ hoverEventCallback = null;
}
-
}
}
if (wheelEventHandler == null)
{
wheelEventCallback = OnWheelEvent;
- this.WheelEventSignal().Connect(wheelEventCallback);
+ wheelEventSignal = this.WheelEventSignal();
+ wheelEventSignal?.Connect(wheelEventCallback);
}
+
wheelEventHandler += value;
if (WindowWheelEventHandler == null)
remove
{
wheelEventHandler -= value;
- if (wheelEventHandler == null && WheelEventSignal().Empty() == false)
+
+ if (wheelEventHandler == null && wheelEventSignal?.Empty() == false)
{
- this.WheelEventSignal().Disconnect(wheelEventCallback);
+ wheelEventSignal?.Disconnect(wheelEventCallback);
+ wheelEventSignal?.Dispose();
+ wheelEventSignal = null;
+ wheelEventCallback = null;
}
WindowWheelEventHandler -= value;
if (onWindowEventHandler == null)
{
onWindowEventCallback = OnWindow;
- this.OnWindowSignal().Connect(onWindowEventCallback);
+ onWindowSignal = this.OnWindowSignal();
+ onWindowSignal?.Connect(onWindowEventCallback);
}
onWindowEventHandler += value;
{
onWindowEventHandler -= value;
- if (onWindowEventHandler == null && OnWindowSignal().Empty() == false)
+ if (onWindowEventHandler == null && onWindowSignal?.Empty() == false)
{
- this.OnWindowSignal().Disconnect(onWindowEventCallback);
+ onWindowSignal?.Disconnect(onWindowEventCallback);
+ onWindowSignal?.Dispose();
+ onWindowSignal = null;
onWindowEventCallback = null;
}
}
if (offWindowEventHandler == null)
{
offWindowEventCallback = OffWindow;
- this.OffWindowSignal().Connect(offWindowEventCallback);
+ offWindowSignal = this.OffWindowSignal();
+ offWindowSignal?.Connect(offWindowEventCallback);
}
offWindowEventHandler += value;
{
offWindowEventHandler -= value;
- if (offWindowEventHandler == null && OffWindowSignal().Empty() == false)
+ if (offWindowEventHandler == null && offWindowSignal?.Empty() == false)
{
- this.OffWindowSignal().Disconnect(offWindowEventCallback);
+ offWindowSignal?.Disconnect(offWindowEventCallback);
+ offWindowSignal.Dispose();
+ offWindowSignal = null;
offWindowEventCallback = null;
}
}
if (visibilityChangedEventHandler == null)
{
visibilityChangedEventCallback = OnVisibilityChanged;
- VisibilityChangedSignal(this).Connect(visibilityChangedEventCallback);
+ visibilityChangedSignal = this.VisibilityChangedSignal(this);
+ visibilityChangedSignal?.Connect(visibilityChangedEventCallback);
}
visibilityChangedEventHandler += value;
{
visibilityChangedEventHandler -= value;
- if (visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false)
+ if (visibilityChangedEventHandler == null && visibilityChangedSignal?.Empty() == false)
{
- VisibilityChangedSignal(this).Disconnect(visibilityChangedEventCallback);
+ visibilityChangedSignal?.Disconnect(visibilityChangedEventCallback);
+ visibilityChangedSignal?.Dispose();
+ visibilityChangedSignal = null;
+ visibilityChangedEventCallback = null;
}
}
}
if (layoutDirectionChangedEventHandler == null)
{
layoutDirectionChangedEventCallback = OnLayoutDirectionChanged;
- LayoutDirectionChangedSignal(this).Connect(layoutDirectionChangedEventCallback);
+ layoutDirectionChangedSignal = this.LayoutDirectionChangedSignal(this);
+ layoutDirectionChangedSignal?.Connect(layoutDirectionChangedEventCallback);
}
layoutDirectionChangedEventHandler += value;
{
layoutDirectionChangedEventHandler -= value;
- if (layoutDirectionChangedEventHandler == null && LayoutDirectionChangedSignal(this).Empty() == false)
+ if (layoutDirectionChangedEventHandler == null && layoutDirectionChangedSignal?.Empty() == false)
{
- LayoutDirectionChangedSignal(this).Disconnect(layoutDirectionChangedEventCallback);
+ layoutDirectionChangedSignal?.Disconnect(layoutDirectionChangedEventCallback);
+ layoutDirectionChangedSignal?.Dispose();
+ layoutDirectionChangedSignal = null;
+ layoutDirectionChangedEventCallback = null;
}
}
}
if (resourcesLoadedEventHandler == null)
{
ResourcesLoadedCallback = OnResourcesLoaded;
- this.ResourcesLoadedSignal().Connect(ResourcesLoadedCallback);
+ resourcesLoadedSignal = this.ResourcesLoadedSignal();
+ resourcesLoadedSignal?.Connect(ResourcesLoadedCallback);
}
resourcesLoadedEventHandler += value;
{
resourcesLoadedEventHandler -= value;
- if (resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
+ if (resourcesLoadedEventHandler == null && resourcesLoadedSignal?.Empty() == false)
{
- this.ResourcesLoadedSignal().Disconnect(ResourcesLoadedCallback);
+ resourcesLoadedSignal?.Disconnect(ResourcesLoadedCallback);
+ resourcesLoadedSignal?.Dispose();
+ resourcesLoadedSignal = null;
ResourcesLoadedCallback = null;
}
}
if (backgroundResourceLoadedEventHandler == null)
{
backgroundResourceLoadedCallback = OnBackgroundResourceLoaded;
- this.ResourcesLoadedSignal().Connect(backgroundResourceLoadedCallback);
+ backgroundResourcesLoadedSignal = this.ResourcesLoadedSignal();
+ backgroundResourcesLoadedSignal?.Connect(backgroundResourceLoadedCallback);
}
backgroundResourceLoadedEventHandler += value;
{
backgroundResourceLoadedEventHandler -= value;
- if (backgroundResourceLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false)
+ if (backgroundResourceLoadedEventHandler == null && backgroundResourcesLoadedSignal?.Empty() == false)
{
- this.ResourcesLoadedSignal().Disconnect(backgroundResourceLoadedCallback);
+ backgroundResourcesLoadedSignal?.Disconnect(backgroundResourceLoadedCallback);
+ backgroundResourcesLoadedSignal?.Dispose();
+ backgroundResourcesLoadedSignal = null;
backgroundResourceLoadedCallback = null;
}
}
}
else if (width != null && height == null)
{
- MinimumSize = new Size2D((int)width, (int)this.GetMinimumSize().Height);
+ Vector2 minSize = this.GetMinimumSize();
+ MinimumSize = new Size2D((int)width, (int)(minSize.Height));
+ minSize.Dispose();
}
else if (width == null && height != null)
{
- MinimumSize = new Size2D((int)this.GetMinimumSize().Width, (int)height);
+ Vector2 minSize = this.GetMinimumSize();
+ MinimumSize = new Size2D((int)(minSize.Width), (int)height);
+ minSize.Dispose();
}
else
{
}
else if (width != null && height == null)
{
- MaximumSize = new Size2D((int)width, (int)this.GetMaximumSize().Height);
+ Vector2 maxSize = this.GetMaximumSize();
+ MaximumSize = new Size2D((int)width, (int)(maxSize.Height));
+ maxSize.Dispose();
}
else if (width == null && height != null)
{
- MaximumSize = new Size2D((int)this.GetMaximumSize().Width, (int)height);
+ Vector2 maxSize = this.GetMaximumSize();
+ MaximumSize = new Size2D((int)(maxSize.Width), (int)height);
+ maxSize.Dispose();
}
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.
- if (this != null)
- {
- DisConnectFromSignals();
- }
+ DisConnectFromSignals();
foreach (View view in Children)
{
if (onRelayoutEventCallback != null)
{
- ViewSignal signal = this.OnRelayoutSignal();
- signal?.Disconnect(onRelayoutEventCallback);
- signal?.Dispose();
+ onRelayoutSignal?.Disconnect(onRelayoutEventCallback);
+ onRelayoutSignal?.Dispose();
+ onRelayoutSignal = null;
onRelayoutEventCallback = null;
}
if (offWindowEventCallback != null)
{
- ViewSignal signal = this.OffWindowSignal();
- signal?.Disconnect(offWindowEventCallback);
- signal?.Dispose();
+ offWindowSignal?.Disconnect(offWindowEventCallback);
+ offWindowSignal?.Dispose();
+ offWindowSignal = null;
offWindowEventCallback = null;
}
if (onWindowEventCallback != null)
{
- ViewSignal signal = this.OnWindowSignal();
- signal?.Disconnect(onWindowEventCallback);
- signal?.Dispose();
+ onWindowSignal?.Disconnect(onWindowEventCallback);
+ onWindowSignal?.Dispose();
+ onWindowSignal = null;
onWindowEventCallback = null;
}
if (wheelEventCallback != null)
{
- WheelSignal signal = this.WheelEventSignal();
- signal?.Disconnect(wheelEventCallback);
- signal?.Dispose();
+ wheelEventSignal?.Disconnect(wheelEventCallback);
+ wheelEventSignal?.Dispose();
+ wheelEventSignal = null;
+ wheelEventCallback = null;
}
if (WindowWheelEventHandler != null)
if (hoverEventCallback != null)
{
- HoverSignal signal = this.HoveredSignal();
- signal?.Disconnect(hoverEventCallback);
- signal?.Dispose();
+ hoveredSignal?.Disconnect(hoverEventCallback);
+ hoveredSignal?.Dispose();
+ hoveredSignal = null;
+ hoverEventCallback = null;
}
if (interceptTouchDataCallback != null)
{
- TouchDataSignal signal = this.InterceptTouchSignal();
- signal?.Disconnect(interceptTouchDataCallback);
- signal?.Dispose();
+ interceptTouchSignal?.Disconnect(interceptTouchDataCallback);
+ interceptTouchSignal?.Dispose();
+ interceptTouchSignal = null;
+ interceptTouchDataCallback = null;
}
if (touchDataCallback != null)
{
- TouchDataSignal signal = this.TouchSignal();
- signal?.Disconnect(touchDataCallback);
- signal?.Dispose();
+ touchSignal?.Disconnect(touchDataCallback);
+ touchSignal?.Dispose();
+ touchSignal = null;
+ touchDataCallback = null;
}
if (ResourcesLoadedCallback != null)
{
- ViewSignal signal = this.ResourcesLoadedSignal();
- signal?.Disconnect(ResourcesLoadedCallback);
- signal?.Dispose();
+ resourcesLoadedSignal?.Disconnect(ResourcesLoadedCallback);
+ resourcesLoadedSignal?.Dispose();
+ resourcesLoadedSignal = null;
ResourcesLoadedCallback = null;
}
if (keyCallback != null)
{
- ControlKeySignal signal = this.KeyEventSignal();
- signal?.Disconnect(keyCallback);
- signal?.Dispose();
+ keyEventSignal?.Disconnect(keyCallback);
+ keyEventSignal?.Dispose();
+ keyEventSignal = null;
+ keyCallback = null;
}
if (keyInputFocusLostCallback != null)
{
- KeyInputFocusSignal signal = this.KeyInputFocusLostSignal();
- signal?.Disconnect(keyInputFocusLostCallback);
- signal?.Dispose();
+ keyInputFocusLostSignal?.Disconnect(keyInputFocusLostCallback);
+ keyInputFocusLostSignal?.Dispose();
+ keyInputFocusLostSignal = null;
+ keyInputFocusLostCallback = null;
}
if (keyInputFocusGainedCallback != null)
{
- KeyInputFocusSignal signal = this.KeyInputFocusGainedSignal();
- signal?.Disconnect(keyInputFocusGainedCallback);
- signal?.Dispose();
+ keyInputFocusGainedSignal?.Disconnect(keyInputFocusGainedCallback);
+ keyInputFocusGainedSignal?.Dispose();
+ keyInputFocusGainedSignal = null;
+ keyInputFocusGainedCallback = null;
}
if (backgroundResourceLoadedCallback != null)
{
- ViewSignal signal = this.ResourcesLoadedSignal();
- signal?.Disconnect(backgroundResourceLoadedCallback);
- signal?.Dispose();
+ backgroundResourcesLoadedSignal?.Disconnect(backgroundResourceLoadedCallback);
+ backgroundResourcesLoadedSignal?.Dispose();
+ backgroundResourcesLoadedSignal = null;
backgroundResourceLoadedCallback = null;
}
if (onWindowSendEventCallback != null)
{
- ViewSignal signal = this.OnWindowSignal();
- signal?.Disconnect(onWindowSendEventCallback);
- signal?.Dispose();
+ onWindowSendSignal?.Disconnect(onWindowSendEventCallback);
+ onWindowSendSignal?.Dispose();
+ onWindowSendSignal = null;
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;