Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Controls/src/Core/Page/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public partial class Page : VisualElement, ILayout, IPageController, IElementCon
public static readonly BindableProperty BackgroundImageSourceProperty = BindableProperty.Create(nameof(BackgroundImageSource), typeof(ImageSource), typeof(Page), default(ImageSource));

/// <summary>Bindable property for <see cref="IsBusy"/>.</summary>
[Obsolete("Page.IsBusy has been deprecated and will be removed in .NET 11")]
public static readonly BindableProperty IsBusyProperty = BindableProperty.Create(nameof(IsBusy), typeof(bool), typeof(Page), false, propertyChanged: (bo, o, n) => ((Page)bo).OnPageBusyChanged());

/// <summary>Bindable property for <see cref="Padding"/>.</summary>
Expand Down Expand Up @@ -128,6 +129,7 @@ public ImageSource IconImageSource
/// <remarks>
/// <para>Setting <see cref="IsBusy"/> to <see langword="true"/> on multiple pages at once will cause the global activity indicator to run until all are set back to <see langword="false"/>. It is the developer's responsibility to unset the <see cref="IsBusy"/> flag before cleaning up a page.</para>
/// </remarks>
[Obsolete("Page.IsBusy has been deprecated and will be removed in .NET 11")]
public bool IsBusy
{
get { return (bool)GetValue(IsBusyProperty); }
Expand Down Expand Up @@ -655,13 +657,15 @@ public void SendAppearing()

_hasAppeared = true;

#pragma warning disable CS0618 // TODO: Remove this API in .NET 11. Issue Link: https://github.com/dotnet/maui/issues/30155
if (IsBusy)
{
if (IsPlatformEnabled)
Window.AlertManager.RequestPageBusy(this, true);
else
_pendingActions.Add(() => Window.AlertManager.RequestPageBusy(this, true));
}
#pragma warning restore CS0618 // Type or member is obsolete

OnAppearing();
Appearing?.Invoke(this, EventArgs.Empty);
Expand All @@ -684,8 +688,10 @@ public void SendDisappearing()

_hasAppeared = false;

#pragma warning disable CS0618 // TODO: Remove this API in .NET 11. Issue Link: https://github.com/dotnet/maui/issues/30155
if (IsBusy)
Window.AlertManager.RequestPageBusy(this, false);
#pragma warning restore CS0618 // Type or member is obsolete

var pageContainer = this as IPageContainer<Page>;
pageContainer?.CurrentPage?.SendDisappearing();
Expand Down Expand Up @@ -746,7 +752,9 @@ void OnPageBusyChanged()
{
if (!_hasAppeared)
return;
#pragma warning disable CS0618 // TODO: Remove this API in .NET 11. Issue Link: https://github.com/dotnet/maui/issues/30155
Window.AlertManager.RequestPageBusy(this, IsBusy);
#pragma warning restore CS0618 // Type or member is obsolete
}

void OnToolbarItemsCollectionChanged(object sender, NotifyCollectionChangedEventArgs args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ internal AlertRequestHelper(Activity context, IMauiContext mauiContext)

public IMauiContext MauiContext { get; }

// TODO: This method is obsolete in .NET 10 and will be removed in .NET11.
public partial void OnPageBusy(Page sender, bool enabled)
{
// Verify that the page making the request is part of this activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public partial void OnAlertRequested(Page sender, AlertArguments arguments) { }

public partial void OnPromptRequested(Page sender, PromptArguments arguments) { }

// TODO: This method is obsolete in .NET 10 and will be removed in .NET 11.
public partial void OnPageBusy(Page sender, bool enabled) { }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal AlertRequestHelper(Window virtualView, UI.Xaml.Window platformView)

public UI.Xaml.Window PlatformView { get; }

// TODO: This method is obsolete in .NET 10 and will be removed in .NET11.
public partial void OnPageBusy(Page sender, bool enabled)
{
// TODO: Wrap the pages in a Canvas, and dynamically add a ProgressBar
Expand Down
6 changes: 5 additions & 1 deletion src/Controls/src/Core/Platform/AlertManager/AlertManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Internals;

Expand Down Expand Up @@ -58,6 +59,7 @@ public void RequestAlert(Page page, AlertArguments arguments) =>
public void RequestPrompt(Page page, PromptArguments arguments) =>
_subscription?.OnPromptRequested(page, arguments);

[Obsolete("This method is obsolete in .NET 10 and will be removed in .NET11.")]
public void RequestPageBusy(Page page, bool isBusy) =>
_subscription?.OnPageBusy(page, isBusy);

Expand All @@ -71,6 +73,7 @@ internal interface IAlertManagerSubscription

void OnPromptRequested(Page sender, PromptArguments arguments);

[Obsolete("This method is obsolete in .NET 10 and will be removed in .NET11.")]
void OnPageBusy(Page sender, bool enabled);
}

Expand All @@ -82,6 +85,7 @@ internal partial class AlertRequestHelper : IAlertManagerSubscription

public partial void OnPromptRequested(Page sender, PromptArguments arguments);

[Obsolete("This method is obsolete in .NET 10 and will be removed in .NET11.")]
public partial void OnPageBusy(Page sender, bool enabled);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal AlertRequestHelper(Window virtualView, UIWindow platformView)

public UIWindow PlatformView { get; }

// TODO: This method is obsolete in .NET 10 and will be removed in .NET 11.
public partial void OnPageBusy(Page sender, bool enabled)
{
_busyCount = Math.Max(0, enabled ? _busyCount + 1 : _busyCount - 1);
Expand Down
2 changes: 2 additions & 0 deletions src/Controls/tests/DeviceTests/Elements/Page/PageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ await CreateHandlerAndAddToWindow<PageHandler>(page, async (handler) =>
public async Task UsingIsBusyNoCrash()
{
var page = new ContentPage();
#pragma warning disable CS0618 // TODO: Remove this API in .NET 11. Issue Link: https://github.com/dotnet/maui/issues/30155
page.IsBusy = true;
#pragma warning restore CS0618 // Type or member is obsolete

await CreateHandlerAndAddToWindow<PageHandler>(page, (handler) =>
{
Expand Down
Loading