-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support CloseRequested and Suspending on macOS
- Loading branch information
1 parent
34fbc75
commit facc0a2
Showing
21 changed files
with
266 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 11 additions & 5 deletions
16
src/Uno.UI/UI/Xaml/Controls/ContentDialog/ContentDialogClosingDeferral.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
using System; | ||
using Windows.Foundation; | ||
|
||
namespace Windows.UI.Xaml.Controls | ||
{ | ||
public partial class ContentDialogClosingDeferral : IDeferral | ||
public partial class ContentDialogClosingDeferral | ||
{ | ||
private Action _deferralAction; | ||
private DeferralCompletedHandler _handler; | ||
|
||
/// <summary> | ||
/// This constructor does not exist in UWP | ||
/// </summary> | ||
public ContentDialogClosingDeferral() { } | ||
|
||
Action IDeferral.DeferralAction { get => _deferralAction; set => _deferralAction = value; } | ||
internal ContentDialogClosingDeferral(DeferralCompletedHandler handler) | ||
{ | ||
_handler = handler; | ||
} | ||
|
||
public void Complete() => _deferralAction?.Invoke(); | ||
public void Complete() => _handler?.Invoke(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Windows.ApplicationModel | ||
{ | ||
public partial interface ISuspendingDeferral | ||
{ | ||
void Complete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace Windows.ApplicationModel | ||
{ | ||
public partial interface ISuspendingEventArgs | ||
{ | ||
SuspendingOperation SuspendingOperation { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace Windows.ApplicationModel | ||
{ | ||
public partial interface ISuspendingOperation | ||
{ | ||
DateTimeOffset Deadline { get; } | ||
|
||
SuspendingDeferral GetDeferral(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using Uno; | ||
using System.Diagnostics; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Metadata; | ||
|
||
namespace Windows.ApplicationModel | ||
{ | ||
public sealed partial class SuspendingDeferral | ||
{ | ||
private Action? _deferralDone; | ||
private readonly Action? _deferralDone; | ||
private readonly DeferralCompletedHandler? _handler; | ||
|
||
/// <summary> | ||
/// This can be removed with other breaking changes | ||
/// </summary> | ||
/// <param name="deferralDone"></param> | ||
[DebuggerHidden] | ||
public SuspendingDeferral(Action? deferralDone) => | ||
_deferralDone = deferralDone; | ||
|
||
public SuspendingDeferral(Action? deferralDone) | ||
=> _deferralDone = deferralDone; | ||
internal SuspendingDeferral(DeferralCompletedHandler handler) => | ||
_handler = handler; | ||
|
||
public void Complete() | ||
=> _deferralDone?.Invoke(); | ||
{ | ||
_deferralDone?.Invoke(); | ||
_handler?.Invoke(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.