Fleet Mobile
Search Results for

    Show / Hide Table of Contents

    Class BasePage

    页面基础类

    Inheritance
    object
    BindableObject
    Element
    StyleableElement
    NavigableElement
    VisualElement
    Page
    TemplatedPage
    ContentPage
    BasePage
    Derived
    SearchingPage<T>
    Implements
    INotifyPropertyChanged
    IVisualTreeElement
    IEffectControlProvider
    IToolTipElement
    IContextFlyoutElement
    IAnimatable
    ILayout
    IPageController
    IVisualElementController
    IElementController
    IElementConfiguration<TElement>
    ISafeAreaView
    ITitledElement
    IToolbarElement
    IContentView
    IPadding
    ICrossPlatformLayout
    IHotReloadableView
    IView
    IElement
    ITransform
    IReplaceableView
    ILoading
    INetworkIndicator
    Inherited Members
    ContentPage.ContentProperty
    ContentPage.HideSoftInputOnTappedProperty
    ContentPage.OnBindingContextChanged()
    ContentPage.MeasureOverride(double, double)
    ContentPage.LayoutChildren(double, double, double, double)
    ContentPage.ArrangeOverride(Rect)
    ContentPage.InvalidateMeasureOverride()
    ContentPage.Content
    ContentPage.HideSoftInputOnTapped
    TemplatedPage.ControlTemplateProperty
    TemplatedPage.OnApplyTemplate()
    TemplatedPage.OnChildRemoved(Element, int)
    TemplatedPage.GetTemplateChild(string)
    TemplatedPage.ControlTemplate
    Page.BusySetSignalName
    Page.AlertSignalName
    Page.PromptSignalName
    Page.ActionSheetSignalName
    Page.BackgroundImageSourceProperty
    Page.IsBusyProperty
    Page.PaddingProperty
    Page.TitleProperty
    Page.IconImageSourceProperty
    Page.DisplayActionSheet(string, string, string, params string[])
    Page.DisplayActionSheet(string, string, string, FlowDirection, params string[])
    Page.DisplayAlert(string, string, string)
    Page.DisplayAlert(string, string, string, string)
    Page.DisplayAlert(string, string, string, FlowDirection)
    Page.DisplayAlert(string, string, string, string, FlowDirection)
    Page.DisplayPromptAsync(string, string, string, string, string, int, Keyboard, string)
    Page.ForceLayout()
    Page.SendBackButtonPressed()
    Page.OnChildMeasureInvalidated(object, EventArgs)
    Page.OnParentSet()
    Page.OnSizeAllocated(double, double)
    Page.UpdateChildrenLayout()
    Page.On<T>()
    Page.OnNavigatingFrom(NavigatingFromEventArgs)
    Page.GetParentWindow()
    Page.BackgroundImageSource
    Page.IconImageSource
    Page.IsBusy
    Page.Padding
    Page.Title
    Page.ToolbarItems
    Page.MenuBarItems
    Page.LayoutChanged
    Page.Appearing
    Page.Disappearing
    Page.NavigatedTo
    Page.NavigatingFrom
    Page.NavigatedFrom
    VisualElement.NavigationProperty
    VisualElement.StyleProperty
    VisualElement.InputTransparentProperty
    VisualElement.IsEnabledProperty
    VisualElement.XProperty
    VisualElement.YProperty
    VisualElement.AnchorXProperty
    VisualElement.AnchorYProperty
    VisualElement.TranslationXProperty
    VisualElement.TranslationYProperty
    VisualElement.WidthProperty
    VisualElement.HeightProperty
    VisualElement.RotationProperty
    VisualElement.RotationXProperty
    VisualElement.RotationYProperty
    VisualElement.ScaleProperty
    VisualElement.ScaleXProperty
    VisualElement.ScaleYProperty
    VisualElement.ClipProperty
    VisualElement.VisualProperty
    VisualElement.IsVisibleProperty
    VisualElement.OpacityProperty
    VisualElement.BackgroundColorProperty
    VisualElement.BackgroundProperty
    VisualElement.BehaviorsProperty
    VisualElement.TriggersProperty
    VisualElement.WidthRequestProperty
    VisualElement.HeightRequestProperty
    VisualElement.MinimumWidthRequestProperty
    VisualElement.MinimumHeightRequestProperty
    VisualElement.MaximumWidthRequestProperty
    VisualElement.MaximumHeightRequestProperty
    VisualElement.IsFocusedProperty
    VisualElement.FlowDirectionProperty
    VisualElement.WindowProperty
    VisualElement.ShadowProperty
    VisualElement.ZIndexProperty
    VisualElement.BatchBegin()
    VisualElement.BatchCommit()
    VisualElement.Focus()
    VisualElement.Measure(double, double)
    VisualElement.Measure(double, double, MeasureFlags)
    VisualElement.Unfocus()
    VisualElement.InvalidateMeasure()
    VisualElement.OnChildAdded(Element)
    VisualElement.OnChildrenReordered()
    VisualElement.OnMeasure(double, double)
    VisualElement.SizeAllocated(double, double)
    VisualElement.ChangeVisualState()
    VisualElement.RefreshIsEnabledProperty()
    VisualElement.Arrange(Rect)
    VisualElement.Layout(Rect)
    VisualElement.MapBackgroundColor(IViewHandler, IView)
    VisualElement.MapBackgroundImageSource(IViewHandler, IView)
    VisualElement.Visual
    VisualElement.FlowDirection
    VisualElement.Window
    VisualElement.AnchorX
    VisualElement.AnchorY
    VisualElement.BackgroundColor
    VisualElement.Background
    VisualElement.Behaviors
    VisualElement.Bounds
    VisualElement.Height
    VisualElement.HeightRequest
    VisualElement.InputTransparent
    VisualElement.IsEnabled
    VisualElement.IsEnabledCore
    VisualElement.IsFocused
    VisualElement.IsVisible
    VisualElement.MinimumHeightRequest
    VisualElement.MinimumWidthRequest
    VisualElement.MaximumHeightRequest
    VisualElement.MaximumWidthRequest
    VisualElement.Opacity
    VisualElement.Rotation
    VisualElement.RotationX
    VisualElement.RotationY
    VisualElement.Scale
    VisualElement.ScaleX
    VisualElement.ScaleY
    VisualElement.TranslationX
    VisualElement.TranslationY
    VisualElement.Triggers
    VisualElement.Width
    VisualElement.WidthRequest
    VisualElement.X
    VisualElement.Y
    VisualElement.Clip
    VisualElement.Resources
    VisualElement.Frame
    VisualElement.Handler
    VisualElement.Shadow
    VisualElement.ZIndex
    VisualElement.DesiredSize
    VisualElement.IsLoaded
    VisualElement.ChildrenReordered
    VisualElement.Focused
    VisualElement.MeasureInvalidated
    VisualElement.SizeChanged
    VisualElement.Unfocused
    VisualElement.Loaded
    VisualElement.Unloaded
    NavigableElement.Navigation
    StyleableElement.Style
    StyleableElement.StyleClass
    StyleableElement.class
    Element.AutomationIdProperty
    Element.ClassIdProperty
    Element.InsertLogicalChild(int, Element)
    Element.AddLogicalChild(Element)
    Element.RemoveLogicalChild(Element)
    Element.ClearLogicalChildren()
    Element.FindByName(string)
    Element.RemoveDynamicResource(BindableProperty)
    Element.SetDynamicResource(BindableProperty, string)
    Element.OnPropertyChanged(string)
    Element.OnParentChanging(ParentChangingEventArgs)
    Element.OnParentChanged()
    Element.OnHandlerChanging(HandlerChangingEventArgs)
    Element.OnHandlerChanged()
    Element.MapAutomationPropertiesIsInAccessibleTree(IElementHandler, Element)
    Element.MapAutomationPropertiesExcludedWithChildren(IElementHandler, Element)
    Element.AutomationId
    Element.ClassId
    Element.Effects
    Element.Id
    Element.StyleId
    Element.Parent
    Element.ChildAdded
    Element.ChildRemoved
    Element.DescendantAdded
    Element.DescendantRemoved
    Element.ParentChanging
    Element.ParentChanged
    Element.HandlerChanging
    Element.HandlerChanged
    BindableObject.BindingContextProperty
    BindableObject.ClearValue(BindableProperty)
    BindableObject.ClearValue(BindablePropertyKey)
    BindableObject.GetValue(BindableProperty)
    BindableObject.IsSet(BindableProperty)
    BindableObject.RemoveBinding(BindableProperty)
    BindableObject.SetBinding(BindableProperty, BindingBase)
    BindableObject.ApplyBindings()
    BindableObject.OnPropertyChanging(string)
    BindableObject.UnapplyBindings()
    BindableObject.SetValue(BindableProperty, object)
    BindableObject.SetValue(BindablePropertyKey, object)
    BindableObject.CoerceValue(BindableProperty)
    BindableObject.CoerceValue(BindablePropertyKey)
    BindableObject.Dispatcher
    BindableObject.BindingContext
    BindableObject.PropertyChanged
    BindableObject.PropertyChanging
    BindableObject.BindingContextChanged
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Extension Methods
    UIExtensions.AppThemeBinding<T, K>(T, BindableProperty, K, K)
    UIExtensions.BackgroundColorBinding<T, TSource, TProperty>(T, Func<TSource, TProperty>, string, IValueConverter, object, string, TSource)
    UIExtensions.Binding<T>(T, BindableProperty, BindingBase)
    UIExtensions.Binding<T, TSource, TProperty>(T, BindableProperty, Func<TSource, TProperty>, string, Action<TSource, TProperty>, BindingMode?, IValueConverter, object, string, TSource)
    UIExtensions.EnabledBinding<T, TSource, TProperty>(T, Func<TSource, TProperty>, string, IValueConverter, object, string, TSource)
    UIExtensions.GridColumnSpan<T>(T, int)
    UIExtensions.GridColumn<T>(T, int)
    UIExtensions.GridRowSpan<T>(T, int)
    UIExtensions.GridRow<T>(T, int)
    UIExtensions.TranslationXBinding<T, TSource, TProperty>(T, Func<TSource, TProperty>, string, IValueConverter, object, string, TSource)
    UIExtensions.VisibleBinding<T, TSource, TProperty>(T, Func<TSource, TProperty>, string, IValueConverter, object, string, TSource)
    UIExtensions.WidthRequestBinding<T, TSource, TProperty>(T, Func<TSource, TProperty>, string, IValueConverter, object, string, TSource)
    ExceptionExtensions.ShowExceptionAsync(INetworkIndicator, Exception, string, bool, bool)
    ExceptionExtensions.StartSafeTask(INetworkIndicator, Action, string, Action<bool>, bool)
    ExceptionExtensions.StartSafeTaskAsync(INetworkIndicator, Func<CancellationToken, Task>, string, Action<bool>, bool, CancellationToken)
    ExceptionExtensions.StartSafeTaskAsync<T>(INetworkIndicator, Func<CancellationToken, Task<T>>, string, Action<bool, T>, bool, CancellationToken)
    Namespace: Fleet.Mobile.Containers
    Assembly: FleetMobile.dll
    Syntax
    public abstract class BasePage : ContentPage, INotifyPropertyChanged, IVisualTreeElement, IEffectControlProvider, IToolTipElement, IContextFlyoutElement, IAnimatable, ILayout, IPageController, IVisualElementController, IElementController, IElementConfiguration<Page>, ISafeAreaView, ITitledElement, IToolbarElement, IContentView, IPadding, ICrossPlatformLayout, IHotReloadableView, IView, IElement, ITransform, IReplaceableView, ILoading, INetworkIndicator

    Constructors

    BasePage()

    Declaration
    public BasePage()

    Fields

    DelayedTime

    默认延迟时间,为 60ms

    Declaration
    protected static readonly TimeSpan DelayedTime
    Field Value
    TimeSpan

    IsLoadingProperty

    Declaration
    public static readonly BindableProperty IsLoadingProperty
    Field Value
    BindableProperty

    IsNetworkFailedProperty

    Declaration
    public static readonly BindableProperty IsNetworkFailedProperty
    Field Value
    BindableProperty

    SafeAreaThicknessProperty

    Declaration
    public static readonly BindableProperty SafeAreaThicknessProperty
    Field Value
    BindableProperty

    isBusy

    标识页面当前是否忙

    Declaration
    protected bool isBusy
    Field Value
    bool

    serializerOptions

    默认序列化选项,字段为默认值时不序列化

    Declaration
    protected static readonly JsonSerializerOptions serializerOptions
    Field Value
    JsonSerializerOptions

    Properties

    BackCommand

    后退按钮触发的指令

    Declaration
    public Command BackCommand { get; }
    Property Value
    Command

    CustomHandlerViews

    获取自定义视图处理器,在页面卸载时会手动断开链接

    Declaration
    protected virtual IEnumerable<VisualElement> CustomHandlerViews { get; }
    Property Value
    IEnumerable<VisualElement>

    IsAutoRotateAllowed

    获取是否允许自动旋转屏幕

    Declaration
    public virtual bool IsAutoRotateAllowed { get; }
    Property Value
    bool

    IsBackButtonVisible

    获取返回按钮是否显示

    Declaration
    protected virtual bool IsBackButtonVisible { get; }
    Property Value
    bool

    IsClosableWhenLoading

    获取页面加载时是否可以被关闭

    Declaration
    protected virtual bool IsClosableWhenLoading { get; }
    Property Value
    bool

    IsFleetBotVisible

    获取 AI 按钮是否显示

    Declaration
    protected virtual bool IsFleetBotVisible { get; }
    Property Value
    bool

    IsLoading

    获取或设置当前页面是否为加载状态

    Declaration
    public bool IsLoading { get; set; }
    Property Value
    bool

    IsNetworkFailed

    获取或设置当前网络状态是否异常

    Declaration
    public bool IsNetworkFailed { get; set; }
    Property Value
    bool

    MainCollectionView

    获取主 CollectionView,默认点击标题区域时将滚动到首行

    Declaration
    protected virtual CollectionView MainCollectionView { get; }
    Property Value
    CollectionView

    SafeAreaInsets

    获取 iOS 页面的安全间距

    Declaration
    protected Thickness SafeAreaInsets { get; }
    Property Value
    Thickness

    SafeAreaThickness

    获取或设置页面安全间距

    Declaration
    public Thickness SafeAreaThickness { get; set; }
    Property Value
    Thickness

    TitleTapCommand

    标题区域触摸触发的指令

    Declaration
    public Command TitleTapCommand { get; }
    Property Value
    Command

    Methods

    AddIconToolbarItem(string, EventHandler, Command)

    Declaration
    protected void AddIconToolbarItem(string glyph, EventHandler handler = null, Command command = null)
    Parameters
    string glyph

    EventHandler handler

    Command command

    AddIconToolbarItem<T>(string, Func<T, bool>, string, T, bool, EventHandler, Command)

    Declaration
    protected void AddIconToolbarItem<T>(string glyph, Func<T, bool> getter, string memberName, T source = default, bool isNegated = false, EventHandler handler = null, Command command = null)
    Parameters
    string glyph

    Func<T, bool> getter

    string memberName

    T source

    bool isNegated

    EventHandler handler

    Command command

    Type Parameters
    T

    AddTextToolbarItem(string, EventHandler, Command)

    Declaration
    protected void AddTextToolbarItem(string text, EventHandler handler = null, Command command = null)
    Parameters
    string text

    EventHandler handler

    Command command

    AddTextToolbarItem<T>(string, Func<T, bool>, string, T, bool, EventHandler, Command)

    Declaration
    protected void AddTextToolbarItem<T>(string text, Func<T, bool> getter, string memberName, T source = default, bool isNegated = false, EventHandler handler = null, Command command = null)
    Parameters
    string text

    Func<T, bool> getter

    string memberName

    T source

    bool isNegated

    EventHandler handler

    Command command

    Type Parameters
    T

    AddToolbarItem(ToolbarItem)

    Declaration
    protected void AddToolbarItem(ToolbarItem item)
    Parameters
    ToolbarItem item

    CancelSource(CancellationTokenSource)

    主动取消令牌信号。

    Declaration
    protected static bool CancelSource(CancellationTokenSource cts)
    Parameters
    CancellationTokenSource cts

    取消令牌源

    Returns
    bool

    令牌不为 null 且被取消成功则返回 true

    CreateProperty<T, V>(string, T, BindingMode, Action<V, T>)

    根据返回类型、名称、默认值、默认绑定模式快速创建属性。

    Declaration
    protected static BindableProperty CreateProperty<T, V>(string name, T defaultValue = default, BindingMode defaultBindingMode = BindingMode.OneWay, Action<V, T> propertyChanged = null) where V : BindableObject
    Parameters
    string name

    属性名称

    T defaultValue

    属性初始值,默认为该类型的默认值

    BindingMode defaultBindingMode

    属性绑定模式,默认为 OneWay

    Action<V, T> propertyChanged

    属性修改回调,传递参数为对象元素和修改后的属性值

    Returns
    BindableProperty

    返回创建的属性

    Type Parameters
    T

    属性返回类型

    V

    所属类型

    Debounce(Action<CancellationToken>, int, bool)

    根据自定义最低间隔去抖动执行方法。

    Declaration
    protected void Debounce(Action<CancellationToken> action, int delay = 400, bool keepContext = false)
    Parameters
    Action<CancellationToken> action

    调用的方法

    int delay

    最小间隔,默认为 400ms

    bool keepContext

    是否以 UI 线程调用,默认 false

    GetTitleHeaderView()

    获取页面标题视图。

    Declaration
    protected virtual IView GetTitleHeaderView()
    Returns
    IView

    默认返回文本内容为 Title 的标签元素,超长则从中间截断

    GetToolbarItem<T>(string, bool, Func<T, bool>, string, T, bool, EventHandler, Command)

    Declaration
    protected static ToolbarItem GetToolbarItem<T>(string text, bool isIcon, Func<T, bool> getter, string memberName, T source = default, bool isNegated = false, EventHandler handler = null, Command command = null)
    Parameters
    string text

    bool isIcon

    Func<T, bool> getter

    string memberName

    T source

    bool isNegated

    EventHandler handler

    Command command

    Returns
    ToolbarItem

    Type Parameters
    T

    InvokeDelayed(Action, TimeSpan, bool, bool, string)

    以自定义间隔执行方法,并捕获错误,根据参数设置显示弹窗。

    Declaration
    protected bool InvokeDelayed(Action action, TimeSpan delayed = default, bool displayAlert = false, bool keepLoading = false, string source = null)
    Parameters
    Action action

    调用的方法

    TimeSpan delayed

    延迟时间,默认为 DelayedTime

    bool displayAlert

    是否显示错误弹窗,默认为 false

    bool keepLoading

    是否保持 IsLoading,默认为 false

    string source

    调用源

    Returns
    bool

    若执行成功返回 true

    OnAppearing()

    When overridden in a derived class, allows application developers to customize behavior immediately prior to the page becoming visible.

    Declaration
    protected override void OnAppearing()
    Overrides
    Page.OnAppearing()

    OnBackAsync()

    子类重写时可自定义返回指令的行为,默认先判断是否可在加载时关闭,堆栈有页面时返回上一页,否则返回主路由。

    Declaration
    protected virtual Task OnBackAsync()
    Returns
    Task

    OnBackButtonPressed()

    Determines the behavior when the back button of the page is pressed.

    Declaration
    protected override bool OnBackButtonPressed()
    Returns
    bool

    true when the back navigation was handled by the override, otherwise false.

    Overrides
    Page.OnBackButtonPressed()
    Remarks

    Application developers can override this method to provide behavior when the back button is pressed. When overridden to handle or cancel the navigation yourself, this method should return true.

    OnBackInternalAsync(bool)

    Declaration
    protected virtual Task OnBackInternalAsync(bool animated = true)
    Parameters
    bool animated

    Returns
    Task

    OnDisappearing()

    When overridden in a derived class, allows the application developer to customize behavior as the page disappears.

    Declaration
    protected override void OnDisappearing()
    Overrides
    Page.OnDisappearing()
    Remarks

    This method is called when the page disappears due to navigating away from the page within the app. It is not called when the app disappears due to an event external to the app (e.g. user navigates to the home screen or another app, a phone call is received, the device is locked, the device is turned off).

    OnNavigatedFrom(NavigatedFromEventArgs)

    When overridden in a derived class, allows application developers to customize behavior immediately after the page was being navigated away from.

    Declaration
    protected override void OnNavigatedFrom(NavigatedFromEventArgs args)
    Parameters
    NavigatedFromEventArgs args

    The event arguments.

    Overrides
    Page.OnNavigatedFrom(NavigatedFromEventArgs)

    OnNavigatedTo(NavigatedToEventArgs)

    When overridden in a derived class, allows application developers to customize behavior immediately after the page was navigated to.

    Declaration
    protected override void OnNavigatedTo(NavigatedToEventArgs args)
    Parameters
    NavigatedToEventArgs args

    The event arguments.

    Overrides
    Page.OnNavigatedTo(NavigatedToEventArgs)

    OnNetworkChanged(bool)

    Declaration
    protected virtual void OnNetworkChanged(bool isConnected)
    Parameters
    bool isConnected

    OnPageLoaded()

    页面加载时调用的方法,若页面未销毁,多次 Push 该页面则调用多次。

    Declaration
    protected virtual void OnPageLoaded()

    OnPageNavigated()

    导航至该页时调用的方法,只触发一次。

    Declaration
    protected virtual void OnPageNavigated()

    OnPageUnloaded()

    页面卸载时调用的方法。

    Declaration
    protected virtual void OnPageUnloaded()

    OnTitleTapped()

    子类重写时可自定义标题点击时的行为,默认为滚动 MainCollectionView 的内容至首行。

    Declaration
    protected virtual void OnTitleTapped()

    R(string, string)

    获取语言资源。

    Declaration
    protected static string R(string lgid, string def = null)
    Parameters
    string lgid

    语言资源 ID

    string def

    资源默认字符串

    Returns
    string

    返回资源在当前语言下的内容,未找到则返回 def

    RemoveToolbarItem(ToolbarItem)

    Declaration
    protected void RemoveToolbarItem(ToolbarItem item)
    Parameters
    ToolbarItem item

    StartWatch()

    开始计时并返回计时器。

    Declaration
    protected static Stopwatch StartWatch()
    Returns
    Stopwatch

    返回已开始的计时器

    Tap(Action)

    执行自定义方法,确保方法执行完成之前只触发一次。

    Declaration
    protected void Tap(Action action)
    Parameters
    Action action

    调用的方法

    Tap(Func<Task>)

    执行自定义任务,确保任务执行完成之前只触发一次。

    Declaration
    protected void Tap(Func<Task> action)
    Parameters
    Func<Task> action

    调用的任务

    Throttle(Action<CancellationToken>, int, bool)

    根据自定义最低间隔节流执行方法。

    Declaration
    protected void Throttle(Action<CancellationToken> action, int delay = 400, bool keepContext = false)
    Parameters
    Action<CancellationToken> action

    调用的方法

    int delay

    最小间隔,默认为 400ms

    bool keepContext

    是否以 UI 线程调用,默认 false

    TriggerLoadingItem<T>(object, Action<T>, bool, Action)

    触发条目时可调用的糖函数,设置 IsLoading 为 true,执行回调完成后重置。

    Declaration
    protected void TriggerLoadingItem<T>(object o, Action<T> action, bool keepLoading = false, Action final = null) where T : ILoading
    Parameters
    object o

    命令参数对象

    Action<T> action

    待执行的回调

    bool keepLoading

    是否保持 IsLoading 为 true

    Action final

    最终执行的回调

    Type Parameters
    T

    实现 ILoading 接口的类型

    TriggerLoadingItem<T>(object, Func<T, Task>)

    触发条目时可调用的糖函数,设置 IsLoading 为 true,执行回调完成后重置。

    Declaration
    protected void TriggerLoadingItem<T>(object o, Func<T, Task> action) where T : ILoading
    Parameters
    object o

    命令参数对象

    Func<T, Task> action

    待执行的任务回调

    Type Parameters
    T

    实现 ILoading 接口的类型

    In this article
    Back to top Generated by DocFX