#endregion //Distructors
#region Delegates
+ internal delegate void BorderCloseDelegate();
+ private BorderCloseDelegate borderCloseDelegate = null;
+
#endregion //Delegates
#region Events
}
/// <summary>
- /// This enum is the policy when resizing the border window.
+ /// This enum is the policy when resizing the border window.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public enum BorderResizePolicyType
#region Methods
/// <summary>
+ /// Called when the border is closed.
+ /// If the delegate is declared, the delegate is called, otherwise window is destroyed.
+ /// </summary>
+ internal void BorderDestroy()
+ {
+ if (borderCloseDelegate != null)
+ {
+ borderCloseDelegate();
+ }
+ else
+ {
+ Destroy();
+ }
+ }
+ /// <summary>
/// Enable the border window with IBorderInterface.
/// This adds a border area to the Window.
/// The border's UI is configured using IBorderInterface.
/// Users can reisze and move by touching the border area.
/// </summary>
/// <param name="borderInterface">The IBorderInterface.</param>
+ /// <param name="borderCloseDelegate">The BorderCloseDelegate. When close, this delegate is called.</param>
/// <returns>Whether the border window is enabled</returns>
- internal bool EnableBorder(IBorderInterface borderInterface = null)
+ internal bool EnableBorder(IBorderInterface borderInterface, BorderCloseDelegate borderCloseDelegate = null)
{
if (isBorderWindow == true)
{
borderInterface = new DefaultBorder();
}
this.borderInterface = borderInterface;
+ this.borderCloseDelegate = borderCloseDelegate;
GetDefaultLayer().Name = "OriginalRootLayer";
if (isBottom) borderHeight += borderInterface.BorderHeight;
// When running the app for the first time, if it runs in full size, do Maximize(true).
- if (screenWidth != 0 && screenHeight != 0 &&
- realWindowSize.Width >= screenWidth && realWindowSize.Height >= screenHeight &&
+ if (screenWidth != 0 && screenHeight != 0 &&
+ realWindowSize.Width >= screenWidth && realWindowSize.Height >= screenHeight &&
IsMaximized() == false)
{
Maximize(true);
// Add a view to the border layer.
GetBorderWindowBottomLayer().Add(rootView);
- InterceptTouchEvent += (s, e) =>
+ InterceptTouchEvent += (s, e) =>
{
if (e.Touch.GetState(0) == PointStateType.Down && IsMaximized() == false)
{
HeightResizePolicy = ResizePolicyType.FillToParent,
BackgroundColor = Color.Transparent,
Layout = new LinearLayout() {
- LinearOrientation = LinearLayout.Orientation.Vertical,
+ LinearOrientation = LinearLayout.Orientation.Vertical,
LinearAlignment = LinearLayout.Alignment.Top
},
Padding = new Extents(padding, padding, padding, padding),
BorderWindow.RequestResizeToServer(Window.ResizeDirection.TopLeft);
}
}
- return false;
+ return true;
}
/// <summary>
BorderWindow.RequestResizeToServer(Window.ResizeDirection.TopRight);
}
}
- return false;
+ return true;
}
BorderWindow.RequestResizeToServer(Window.ResizeDirection.BottomLeft);
}
}
- return false;
+ return true;
}
/// <summary>
BorderWindow.RequestResizeToServer(Window.ResizeDirection.BottomRight);
}
}
- return false;
+ return true;
}
{
MinimizeBorderWindow();
}
- return false;
+ return true;
}
/// <summary>
{
MaximizeBorderWindow();
}
- return false;
+ return true;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
protected void CloseBorderWindow()
{
- BorderWindow.Destroy();
- BorderWindow = null;
+ BorderWindow.BorderDestroy();
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual bool OnCloseIconTouched(object sender, View.TouchEventArgs e)
{
- if (e == null)
- {
- return false;
- }
if (e != null && e.Touch.GetState(0) == PointStateType.Up)
{
CloseBorderWindow();
}
- return false;
+ return true;
}
/// </summary>
/// <param name="isMaximized">If window is maximized or unmaximized.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- public virtual void OnMaximize(bool isMaximized)
+ public virtual void OnMaximize(bool isMaximized)
{
UpdateIcons();
}
BorderWindow.InterceptTouchEvent -= OnWinInterceptedTouch;
}
+ borderView?.Dispose();
+ windowView?.Dispose();
borderPanGestureDetector?.Dispose();
borderPinchGestureDetector?.Dispose();
backgroundColor?.Dispose();
rightCornerIcon?.Dispose();
timer?.Dispose();
overlayTimer?.Dispose();
- windowView?.Dispose();
- borderView?.Dispose();
}
disposed = true;
}