Class SkiaShell
A Canvas with Navigation capabilities
public class SkiaShell : BasePageReloadable, INotifyPropertyChanged, IVisualTreeElement, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, ILayout, IPageController, IVisualElementController, IElementController, IElementConfiguration<Page>, ISafeAreaView, ITitledElement, IToolbarElement, IContentView, IPadding, ICrossPlatformLayout, IHotReloadableView, IView, IElement, ITransform, IReplaceableView, IDisposable
- Inheritance
-
SkiaShell
- Implements
- Inherited Members
- Extension Methods
Constructors
SkiaShell()
public SkiaShell()
Fields
LockLayers
protected SemaphoreSlim LockLayers
Field Value
LockNavigation
protected SemaphoreSlim LockNavigation
Field Value
LogEnabled
public static bool LogEnabled
Field Value
PopupBackgroundColor
Default background tint for freezing popups/modals etc
public static Color PopupBackgroundColor
Field Value
PopupsAnimationSpeed
public static float PopupsAnimationSpeed
Field Value
PopupsBackgroundBlur
Default background blur amount for freezing popups/modals etc
public static float PopupsBackgroundBlur
Field Value
PopupsCancelAnimationsAfterMs
public static int PopupsCancelAnimationsAfterMs
Field Value
RouteProperty
public static readonly BindableProperty RouteProperty
Field Value
Services
protected readonly IServiceProvider Services
Field Value
ToastBackgroundColor
public static Color ToastBackgroundColor
Field Value
ToastTextColor
public static Color ToastTextColor
Field Value
ToastTextFont
public static string ToastTextFont
Field Value
ToastTextFontWeight
public static int ToastTextFontWeight
Field Value
ToastTextMargins
public static double ToastTextMargins
Field Value
ToastTextSize
public static double ToastTextSize
Field Value
ZIndexModals
public static int ZIndexModals
Field Value
ZIndexPopups
public static int ZIndexPopups
Field Value
ZIndexToasts
public static int ZIndexToasts
Field Value
_lockLayers
protected object _lockLayers
Field Value
_rootRoute
protected string _rootRoute
Field Value
_topmost
protected SkiaControl _topmost
Field Value
Properties
BottomInsets
public double BottomInsets { get; set; }
Property Value
Buffer
Can use to pass items as models between viewmodels
public static Dictionary<string, object> Buffer { get; }
Property Value
Canvas
public Canvas Canvas { get; }
Property Value
CurrentRoute
public SkiaShell.ShellCurrentRoute CurrentRoute { get; protected set; }
Property Value
CurrentRouteAuto
public string CurrentRouteAuto { get; }
Property Value
FreezingModals
public List<SkiaControl> FreezingModals { get; protected set; }
Property Value
FrozenLayers
public Dictionary<SkiaControl, SkiaControl> FrozenLayers { get; }
Property Value
Initialized
public bool Initialized { get; protected set; }
Property Value
MenuItems
public ObservableCollection<MenuPageItem> MenuItems { get; }
Property Value
ModalStack
public IReadOnlyList<Page> ModalStack { get; }
Property Value
NavigationLayout
The main control that pushes pages, switches tabs etc
public SkiaViewSwitcher NavigationLayout { get; set; }
Property Value
NavigationStack
public IReadOnlyList<Page> NavigationStack { get; }
Property Value
NavigationStackModals
public LinkedList<SkiaShell.PageInStack> NavigationStackModals { get; }
Property Value
NavigationStackScreens
public LinkedList<SkiaShell.PageInStack> NavigationStackScreens { get; }
Property Value
OnShellGoBack
public static SkiaShell.IHandleGoBack OnShellGoBack { get; set; }
Property Value
OrderedRoute
public string OrderedRoute { get; protected set; }
Property Value
Popups
public SkiaShell.NavigationLayer<SkiaControl> Popups { get; }
Property Value
RootLayout
Use this for covering everything in a modal way, precisely tabs
public SkiaControl RootLayout { get; set; }
Property Value
ShellLayout
public SkiaControl ShellLayout { get; set; }
Property Value
StatusBarHeight
public double StatusBarHeight { get; set; }
Property Value
Toasts
public SkiaShell.NavigationLayer<SkiaControl> Toasts { get; }
Property Value
TopInsets
public double TopInsets { get; set; }
Property Value
Methods
AddToCurrentRouteNodes(string, SkiaControl)
protected void AddToCurrentRouteNodes(string registered, SkiaControl created)
Parameters
registeredstringcreatedSkiaControl
ApplyShellPropertiesToCanvas()
public virtual void ApplyShellPropertiesToCanvas()
AwaitLayersLock(string)
protected virtual Task AwaitLayersLock(string caller = null)
Parameters
callerstring
Returns
AwaitNavigationLock(string)
protected virtual Task AwaitNavigationLock(string caller = null)
Parameters
callerstring
Returns
BuildRoute(string, IDictionary<string, object>)
public static string BuildRoute(string host, IDictionary<string, object> arguments = null)
Parameters
hoststringargumentsIDictionary<string, object>
Returns
CanFreezeLayout()
Override this if you have custom navigation layers and custom logic to decide if we can unfreeze background.
public virtual bool CanFreezeLayout()
Returns
CanUnfreezeLayout()
Override this if you have custom navigation layers and custom logic to decide if we can unfreeze background.
public virtual bool CanUnfreezeLayout()
Returns
CloseAllPopups()
public Task CloseAllPopups()
Returns
CloseAllToasts()
public Task CloseAllToasts()
Returns
ClosePopupAsync(SkiaControl, bool)
public Task ClosePopupAsync(SkiaControl popup, bool animated)
Parameters
popupSkiaControlanimatedbool
Returns
ClosePopupAsync(bool)
Close topmost popup
public Task ClosePopupAsync(bool animated)
Parameters
animatedbool
Returns
CreateModalDrawer(bool, bool, bool, Color)
protected virtual SkiaShell.ModalWrapper CreateModalDrawer(bool useGestures, bool animated, bool willFreeze, Color backgroundColor)
Parameters
Returns
Dispose(bool)
protected override void Dispose(bool isDisposing)
Parameters
isDisposingbool
ExecuteActionRoute(string)
public static bool ExecuteActionRoute(string route)
Parameters
routestring
Returns
FormatRoute(List<string>)
public static string FormatRoute(List<string> segments)
Parameters
Returns
FormatRoute(string)
public static string FormatRoute(string route)
Parameters
routestring
Returns
FreezeRootLayout(SkiaControl, SKImage, bool, Color, float)
public virtual Task FreezeRootLayout(SkiaControl control, SKImage screenshot, bool animated, Color tintScreenshot, float blurScreenshot)
Parameters
controlSkiaControlscreenshotSKImageanimatedbooltintScreenshotColorblurScreenshotfloat
Returns
FreezeRootLayout(SkiaControl, bool, Color, float)
Freezes layout below the overlay: takes screenshot of RootLayout, places it over, then hides RootLayout to avoid rendering it. Can override
public virtual Task FreezeRootLayout(SkiaControl control, bool animated, Color tintScreenshot, float blurScreenshot)
Parameters
controlSkiaControlanimatedbooltintScreenshotColorblurScreenshotfloat
Returns
FreezeRootLayoutInternal(SkiaControl, SkiaControl, bool)
public virtual Task FreezeRootLayoutInternal(SkiaControl control, SkiaControl screenshot, bool animated)
Parameters
controlSkiaControlscreenshotSkiaControlanimatedbool
Returns
GetOrCreateContent(string)
public BindableObject GetOrCreateContent(string route)
Parameters
routestring
Returns
GetOrCreateContentSetArguments<T>(string, IDictionary<string, object>)
public virtual T GetOrCreateContentSetArguments<T>(string part, IDictionary<string, object> arguments) where T : BindableObject
Parameters
partstringargumentsIDictionary<string, object>
Returns
- T
Type Parameters
T
GetTopModal()
public SkiaControl GetTopModal()
Returns
GetTopPopup()
public SkiaControl GetTopPopup()
Returns
GetTopmostView()
Gets the topmost visible view: if no popups and modals are open then return NavigationLayout otherwise return the topmost popup or modal depending which ZIndexModals or ZIndexPopups is higher. If view is inside a shell wrapper will return just the view.
public SkiaControl GetTopmostView()
Returns
GetTopmostViewInternal()
Gets the topmost visible view: if no popups and modals are open then return NavigationLayout otherwise return the topmost popup or modal depending which ZIndexModals or ZIndexPopups is higher. If pushed view is inside a shell wrapper will return the wrapper.
public SkiaControl GetTopmostViewInternal()
Returns
GoBack(bool)
public virtual bool GoBack(bool animate)
Parameters
animatebool
Returns
GoBackDefault(bool)
public bool GoBackDefault(bool animate)
Parameters
animatebool
Returns
GoBackInRoute(bool)
This will not affect popups
protected Task<SkiaControl> GoBackInRoute(bool animate)
Parameters
animatebool
Returns
GoToAsync(ShellNavigationState)
public virtual Task GoToAsync(ShellNavigationState state)
Parameters
stateShellNavigationState
Returns
GoToAsync(ShellNavigationState, bool?, IDictionary<string, object>)
Navigate to a registered route. Arguments will be taken from query string of can be passed as parameter. You can receive them by implementing IQueryAttributable or using attribute [QueryProperty] in the page itsself or in the ViewModel that must be the screen's BindingContext upon registered screen instatiation. Animate can be specified otherwise will use it from Shell.PresentationMode attached property. This property will be also used for pushing as page, modal etc.
public virtual Task GoToAsync(ShellNavigationState state, bool? animate = null, IDictionary<string, object> arguments = null)
Parameters
stateShellNavigationStateanimatebool?argumentsIDictionary<string, object>
Returns
HasTopmostModalBindingContext<T>()
public bool HasTopmostModalBindingContext<T>()
Returns
Type Parameters
T
ImportNavigationLayout(bool)
protected virtual void ImportNavigationLayout(bool replace = false)
Parameters
replacebool
ImportRootLayout(bool)
protected virtual void ImportRootLayout(bool replace = false)
Parameters
replacebool
Initialize(string)
public virtual void Initialize(string route)
Parameters
routestring
NotifyAndCheckCanNavigate(SkiaControl, string, NavigationSource)
protected virtual bool NotifyAndCheckCanNavigate(SkiaControl view, string route, NavigationSource source)
Parameters
viewSkiaControlroutestringsourceNavigationSource
Returns
OnCurrentRouteChanged()
protected virtual void OnCurrentRouteChanged()
OnDisposing()
protected virtual void OnDisposing()
OnHandlerChanged()
When overridden in a derived class, should raise the HandlerChanged event.
protected override void OnHandlerChanged()
Remarks
It is the implementor's responsibility to raise the HandlerChanged event.
OnLayersChanged(SkiaControl)
Setup _topmost and send OnAppeared / OnDisappeared to views. Occurs when layers configuration changes, some layer go visible, some not, some are added, some are removed.
protected virtual void OnLayersChanged(SkiaControl dissapeared = null)
Parameters
dissapearedSkiaControl
OnLayoutInvalidated()
public virtual void OnLayoutInvalidated()
OnModalStackChanged(int)
public virtual void OnModalStackChanged(int count)
Parameters
countint
OnNavigated(SkiaShellNavigatedArgs)
protected virtual void OnNavigated(SkiaShellNavigatedArgs e)
Parameters
OnNavigating(SkiaShellNavigatingArgs)
protected virtual void OnNavigating(SkiaShellNavigatingArgs e)
Parameters
OnPagesStackChanged(int)
public virtual void OnPagesStackChanged(int count)
Parameters
countint
OnPopupsStackChanged(int)
public virtual void OnPopupsStackChanged(int count)
Parameters
countint
OnStarted()
protected virtual void OnStarted()
OnToastsStackChanged(int)
public virtual void OnToastsStackChanged(int count)
Parameters
countint
OpenPopupAsync(SkiaControl, bool, bool, bool, Color, SKPoint?)
Pass pixelsScaleInFrom you you want popup to animate appearing from a specific point instead of screen center.
public Task<SkiaControl> OpenPopupAsync(SkiaControl content, bool animated = true, bool closeWhenBackgroundTapped = true, bool showOverlay = true, Color backgroundColor = null, SKPoint? pixelsScaleInFrom = null)
Parameters
contentSkiaControlanimatedboolcloseWhenBackgroundTappedboolshowOverlayboolbackgroundColorColorpixelsScaleInFromSKPoint?
Returns
ParseRoute(string)
public static SkiaShell.ParsedRoute ParseRoute(string route)
Parameters
routestring
Returns
ParseState(ShellNavigationState)
public static SkiaShell.ParsedRoute ParseState(ShellNavigationState state)
Parameters
stateShellNavigationState
Returns
PopAsync(bool)
Returns the page so you could dispose it if needed. Uses ViewSwitcher.
public virtual Task<BindableObject> PopAsync(bool animated = true)
Parameters
animatedbool
Returns
PopModalAsync(PageInStack, bool)
public virtual Task<BindableObject> PopModalAsync(SkiaShell.PageInStack inStack, bool animated)
Parameters
inStackSkiaShell.PageInStackanimatedbool
Returns
PopModalAsync(SkiaControl, bool)
protected Task<SkiaControl> PopModalAsync(SkiaControl modal, bool animated)
Parameters
modalSkiaControlanimatedbool
Returns
PopModalAsync(bool)
public virtual Task<BindableObject> PopModalAsync(bool animated)
Parameters
animatedbool
Returns
PopTabToRoot()
public Task PopTabToRoot()
Returns
PopToRootAsync()
public Task PopToRootAsync()
Returns
PresentAsync(string, bool?, IDictionary<string, object>)
public virtual Task<SkiaControl> PresentAsync(string registered, bool? animate, IDictionary<string, object> arguments = null)
Parameters
registeredstringanimatebool?argumentsIDictionary<string, object>
Returns
PushAsync(BindableObject, bool, bool)
Uses ViewSwitcher to push a view on the canvas, into the current tab if any.
public virtual Task PushAsync(BindableObject page, bool animated = true, bool notify = true)
Parameters
pageBindableObjectanimatedboolnotifybool
Returns
PushAsync(string, bool, IDictionary<string, object>)
Uses ViewSwitcher to push a view on the canvas, into the current tab if any. We can use a route with arguments to instantiate the view instead of passing an instance.
public virtual Task PushAsync(string registered, bool animated = true, IDictionary<string, object> arguments = null)
Parameters
registeredstringanimatedboolargumentsIDictionary<string, object>
Returns
PushModalAsync(BindableObject, bool, bool, bool, IDictionary<string, object>)
Creates a SkiaDrawer opening over the RootLayout with the passed content. Override this method to create your own implementation. Default freezing background is True, control with frozenLayerBackgroundParameters parameter.
public virtual Task<SkiaControl> PushModalAsync(BindableObject page, bool useGestures, bool animated = true, bool freezeBackground = true, IDictionary<string, object> arguments = null)
Parameters
pageBindableObjectuseGesturesboolanimatedboolfreezeBackgroundboolargumentsIDictionary<string, object>
Returns
PushModalAsync(string, bool, bool, bool, IDictionary<string, object>)
public virtual Task PushModalAsync(string registered, bool useGestures, bool animated = true, bool freezeBackground = true, IDictionary<string, object> arguments = null)
Parameters
registeredstringuseGesturesboolanimatedboolfreezeBackgroundboolargumentsIDictionary<string, object>
Returns
PushModalRoute(SkiaControl, string, bool?)
protected virtual Task<SkiaControl> PushModalRoute(SkiaControl skia, string route, bool? animate)
Parameters
skiaSkiaControlroutestringanimatebool?
Returns
PushRegisteredPageAsync(string, bool, IDictionary<string, object>)
public virtual Task PushRegisteredPageAsync(string registered, bool animate, IDictionary<string, object> arguments = null)
Parameters
registeredstringanimateboolargumentsIDictionary<string, object>
Returns
RegisterActionRoute(string, Action)
public static void RegisterActionRoute(string route, Action switchToTab)
Parameters
RegisterRoute(string, TypeRouteFactory)
public static void RegisterRoute(string route, SkiaShell.TypeRouteFactory factory)
Parameters
routestringfactorySkiaShell.TypeRouteFactory
RegisterRoute(string, Type)
public void RegisterRoute(string route, Type type)
Parameters
RemoveAsync(SkiaControl, bool?, IDictionary<string, object>)
public virtual Task<SkiaControl> RemoveAsync(SkiaControl modal, bool? animate, IDictionary<string, object> arguments = null)
Parameters
modalSkiaControlanimatebool?argumentsIDictionary<string, object>
Returns
RemoveFromCurrentRouteNodes(SkiaControl)
protected bool RemoveFromCurrentRouteNodes(SkiaControl control)
Parameters
controlSkiaControl
Returns
ReplaceRootLayout(ISkiaControl)
protected virtual void ReplaceRootLayout(ISkiaControl newLayout)
Parameters
newLayoutISkiaControl
ReplaceShellLayout(ISkiaControl)
protected virtual void ReplaceShellLayout(ISkiaControl newLayout)
Parameters
newLayoutISkiaControl
Reset()
protected virtual void Reset()
SetArguments(BindableObject, IDictionary<string, object>)
protected virtual void SetArguments(BindableObject page, IDictionary<string, object> arguments)
Parameters
pageBindableObjectargumentsIDictionary<string, object>
SetCurrentRouteNodes(List<ShellStackChild>)
protected void SetCurrentRouteNodes(List<SkiaShell.ShellStackChild> children)
Parameters
childrenList<SkiaShell.ShellStackChild>
SetFrozenLayerVisibility(SkiaControl, bool)
Display or hide the background scrrenshot assotiated with an overlay control
protected Task SetFrozenLayerVisibility(SkiaControl control, bool isVisible)
Parameters
controlSkiaControlisVisiblebool
Returns
SetRoot(string, bool, IDictionary<string, object>)
Returns true if was replaced
public virtual SkiaControl SetRoot(string host, bool replace, IDictionary<string, object> arguments = null)
Parameters
hoststringreplaceboolargumentsIDictionary<string, object>
Returns
Exceptions
SetRoute(BindableObject, string)
public static void SetRoute(BindableObject obj, string value)
Parameters
objBindableObjectvaluestring
SetupAppeared(SkiaControl)
protected virtual void SetupAppeared(SkiaControl control)
Parameters
controlSkiaControl
SetupDisappeared(SkiaControl)
protected virtual void SetupDisappeared(SkiaControl control)
Parameters
controlSkiaControl
SetupFrozenLayersVisibility(SkiaControl)
protected void SetupFrozenLayersVisibility(SkiaControl except)
Parameters
exceptSkiaControl
SetupModalsVisibility(SkiaControl)
public virtual Task<bool> SetupModalsVisibility(SkiaControl control)
Parameters
controlSkiaControl
Returns
SetupRoot(ISkiaControl)
Main control inside RootLayout
protected virtual void SetupRoot(ISkiaControl shellLayout)
Parameters
shellLayoutISkiaControl
ShowToast(SkiaControl, int)
public void ShowToast(SkiaControl content, int msShowTime = 4000)
Parameters
contentSkiaControlmsShowTimeint
ShowToast(string, int)
public virtual void ShowToast(string text, int msShowTime = 4000)
Parameters
UnfreezeRootLayout(SkiaControl, bool)
pass who frozen the layout
public virtual Task UnfreezeRootLayout(SkiaControl control, bool animated)
Parameters
controlSkiaControlanimatedbool
Returns
UnlockLayers(string)
protected virtual void UnlockLayers(string caller = null)
Parameters
callerstring
UnlockNavigation(string)
protected virtual void UnlockNavigation(string caller = null)
Parameters
callerstring
UpdateLayout()
public void UpdateLayout()
WrapScreenshot(SkiaControl, SKImage, Color, float, bool)
Override this to create your own image with your own effect of the screenshot to be placed under modal controls. Default is image with Darken Effect.
public virtual SkiaImage WrapScreenshot(SkiaControl control, SKImage screenshot, Color tint, float blur, bool animated)
Parameters
controlSkiaControlscreenshotSKImagetintColorblurfloatanimatedbool
Returns
Events
ModalStackChanged
public event EventHandler<int> ModalStackChanged
Event Type
Navigated
public event EventHandler<SkiaShellNavigatedArgs> Navigated
Event Type
Navigating
public event EventHandler<SkiaShellNavigatingArgs> Navigating
Event Type
OnRotation
public event EventHandler<RotationEventArgs> OnRotation
Event Type
PagesStackChanged
public event EventHandler<int> PagesStackChanged
Event Type
PopupsStackChanged
public event EventHandler<int> PopupsStackChanged
Event Type
RouteChanged
public event EventHandler RouteChanged
Event Type
TabReselected
public event EventHandler<IndexArgs> TabReselected
Event Type
ToastsStackChanged
public event EventHandler<int> ToastsStackChanged