diff options
author | Paul DiPietro <pauldipietro@users.noreply.github.com> | 2016-11-15 13:41:19 -0600 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-15 11:41:19 -0800 |
commit | 6bc6ee5c712b2d29402e895993e38b4666acc3f9 (patch) | |
tree | 1b94421da8b0bc198a4255e5296b283e7c9e2a01 /Xamarin.Forms.Controls.Issues | |
parent | a6bbed029c64d2d64b74eeb67e27a099abf70664 (diff) | |
download | xamarin-forms-6bc6ee5c712b2d29402e895993e38b4666acc3f9.tar.gz xamarin-forms-6bc6ee5c712b2d29402e895993e38b4666acc3f9.tar.bz2 xamarin-forms-6bc6ee5c712b2d29402e895993e38b4666acc3f9.zip |
[WinRT] Fix ModalPushed/ModalPopped not firing (#490)
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
2 files changed, 94 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43663.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43663.cs new file mode 100644 index 00000000..69bba9c6 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43663.cs @@ -0,0 +1,93 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System; +using System.Runtime.CompilerServices; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 43663, "ModalPushed and ModalPopped not working on WinRT", PlatformAffected.WinRT)] + public class Bugzilla43663 : TestNavigationPage + { + protected override void Init() + { + Application.Current.ModalPushed += ModalPushed; + Application.Current.ModalPopped += ModalPopped; + + var initialPage = new ContentPage(); + var insertedPage = new ContentPage + { + Content = new StackLayout + { + Children = + { + new Label { Text = "This page's appearing unsubscribes from the ModalPushed/ModalPopped events" }, + new Button + { + Text = "Go back", + Command = new Command(async () => await Navigation.PopModalAsync()) + } + } + } + }; + insertedPage.Appearing += (s, e) => + { + Application.Current.ModalPushed -= ModalPushed; + Application.Current.ModalPopped -= ModalPopped; + }; + + var modalPage = new ContentPage(); + modalPage.Content = new StackLayout + { + Children = + { + new Label { Text = "Modal" }, + new Button + { + Text = "Click to dismiss modal", + Command = new Command(async() => + { + await Navigation.PopModalAsync(); + }) + } + }, + }; + + initialPage.Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = + { + new Button + { + Text = "Click to push Modal", + Command = new Command(async () => await Navigation.PushModalAsync(modalPage)) + }, + new Button + { + Text = "Go back", + Command = new Command(async () => await Navigation.PopAsync()) + } + } + }; + + PushAsync(initialPage); + Navigation.InsertPageBefore(insertedPage, initialPage); + } + + void ModalPushed(object sender, ModalPushedEventArgs e) + { + DisplayAlert("Pushed", "Message", "Cancel"); + } + + void ModalPopped(object sender, ModalPoppedEventArgs e) + { + DisplayAlert("Popped", "Message", "Cancel"); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 263feb5d..bc656f77 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -127,6 +127,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42364.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla42519.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43516.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla43663.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44166.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44461.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla44584.cs" /> |