-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6818 from Youssef1313/issues/1929
fix: Hide open flyouts when MessageDialog is shown
- Loading branch information
Showing
6 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/Uno.UI.RuntimeTests/Tests/Windows_UI_Popups/Given_MessageDialog.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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Windows.UI.Popups; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Media; | ||
using static Private.Infrastructure.TestServices; | ||
|
||
namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Popups | ||
{ | ||
[TestClass] | ||
public class Given_MessageDialog | ||
{ | ||
#if !__WASM__ | ||
[TestMethod] | ||
[RunsOnUIThread] | ||
public async Task Should_Close_Open_Popups() | ||
{ | ||
var button = new Windows.UI.Xaml.Controls.Button(); | ||
var flyout = new Flyout(); | ||
FlyoutBase.SetAttachedFlyout(button, flyout); | ||
WindowHelper.WindowContent = button; | ||
Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); | ||
FlyoutBase.ShowAttachedFlyout(button); | ||
Assert.AreEqual(1, VisualTreeHelper.GetOpenPopups(Window.Current).Count); | ||
var messageDialog = new MessageDialog("Hello"); | ||
var asyncOperation = messageDialog.ShowAsync(); | ||
Assert.AreEqual(0, VisualTreeHelper.GetOpenPopups(Window.Current).Count); | ||
asyncOperation.Cancel(); | ||
} | ||
#endif | ||
} | ||
} |
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
6 changes: 2 additions & 4 deletions
6
src/Uno.UWP/Uno/DispatcherTimerHelper.cs → src/Uno.UWP/Helpers/DispatcherTimerProxy.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
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,15 @@ | ||
#nullable enable | ||
|
||
using System; | ||
|
||
namespace Uno.Helpers | ||
{ | ||
internal static class VisualTreeHelperProxy | ||
{ | ||
private static Action? _closeAllPopups; | ||
|
||
public static void CloseAllPopups() => _closeAllPopups?.Invoke(); | ||
|
||
public static void SetCloseAllPopupsAction(Action closeAllPopups) => _closeAllPopups = closeAllPopups; | ||
} | ||
} |
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