-
Notifications
You must be signed in to change notification settings - Fork 2k
Add ApplicationHandler #2653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add ApplicationHandler #2653
Changes from 31 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
7f41710
Remove Device.OpenUri
mattleibow 1c5cb5a
Don't use flags for this
mattleibow a82ccd9
Remove Flags and SetFlags
mattleibow 3cd14af
remove more
mattleibow 2b10661
move to the correct folder
mattleibow 6c0157a
oops
mattleibow 5ea88ed
more oops
mattleibow bf3144e
oops
mattleibow fb5d222
ns
mattleibow 7fe0ad0
Add ApplicationHandler
mattleibow 6c6f8e0
Pass it all along
mattleibow dbf04d5
comment
mattleibow 0128287
fix the test
mattleibow e21ef19
Merge remote-tracking branch 'origin/main' into dev/openuriaction
mattleibow 7a129a1
Merge branch 'dev/openuriaction' into dev/apphandler
mattleibow 6abf1aa
- fix shadowing
PureWeen 894a3c8
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow 742e1ff
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow dd76b6d
Clean up a few things
mattleibow 22da1ef
oops
mattleibow ed5d8eb
BetterName
mattleibow 3e1221e
Overloads not supported anymore
mattleibow 2ad5aaf
this
mattleibow 94c506e
oops
mattleibow fa3c3fb
MacCat can terminate
mattleibow 0e8f3d6
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow 2aaa7a4
Fix the device tests
mattleibow 34d072f
Merge branch 'main' into dev/apphandler
mattleibow e5402cc
that
mattleibow 54f9663
This is not a useful property
mattleibow b9ce663
same names
mattleibow 5a0db8a
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow 7c2fba7
Push what I have
mattleibow 941c27a
Programmatically
mattleibow b783e7e
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow e2c53c4
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow 7d2f2d5
More changes
mattleibow 14a0582
oops
mattleibow ae39dec
Merge remote-tracking branch 'origin/main' into dev/apphandler
mattleibow 08c6b8f
Fix the stack overflow
mattleibow fa8ad64
The tests start too fast!
mattleibow f865f16
Use a testing context
mattleibow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
17 changes: 17 additions & 0 deletions
17
src/Controls/samples/Controls.Sample/Pages/Core/ApplicationControlPage.xaml
This file contains hidden or 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,17 @@ | ||
| <views:BasePage | ||
| xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Pages.ApplicationControlPage" | ||
| xmlns:views="clr-namespace:Maui.Controls.Sample.Pages.Base" | ||
| Title="App Control"> | ||
|
|
||
| <VerticalStackLayout Padding="12" Spacing="6"> | ||
|
|
||
| <Button Text="Terminate Application" | ||
| Clicked="OnTerminateClicked" | ||
| HorizontalOptions="Start" | ||
| Padding="20,10" /> | ||
|
|
||
| </VerticalStackLayout> | ||
|
|
||
| </views:BasePage> |
18 changes: 18 additions & 0 deletions
18
src/Controls/samples/Controls.Sample/Pages/Core/ApplicationControlPage.xaml.cs
This file contains hidden or 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,18 @@ | ||
| using System; | ||
| using Microsoft.Maui.Controls; | ||
|
|
||
| namespace Maui.Controls.Sample.Pages | ||
| { | ||
| public partial class ApplicationControlPage | ||
| { | ||
| public ApplicationControlPage() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
|
|
||
| void OnTerminateClicked(object sender, EventArgs e) | ||
| { | ||
| Application.Current.Quit(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
src/Core/src/Handlers/Application/ApplicationHandler.Android.cs
This file contains hidden or 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,13 @@ | ||
| using Android.App; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Microsoft.Maui.Handlers | ||
| { | ||
| public partial class ApplicationHandler : ElementHandler<IApplication, Application> | ||
| { | ||
| public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) | ||
| { | ||
| handler.Logger?.LogWarning("Android does not support programatically terminating the app."); | ||
|
mattleibow marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
src/Core/src/Handlers/Application/ApplicationHandler.Standard.cs
This file contains hidden or 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 Microsoft.Maui.Handlers | ||
| { | ||
| public partial class ApplicationHandler : ElementHandler<IApplication, object> | ||
| { | ||
| protected override object CreateNativeElement() => throw new NotImplementedException(); | ||
|
|
||
| public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) { } | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/Core/src/Handlers/Application/ApplicationHandler.Windows.cs
This file contains hidden or 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,10 @@ | ||
| namespace Microsoft.Maui.Handlers | ||
| { | ||
| public partial class ApplicationHandler : ElementHandler<IApplication, UI.Xaml.Application> | ||
| { | ||
| public static void MapTerminate(ApplicationHandler handler, IApplication application, object? args) | ||
| { | ||
| handler.NativeView.Exit(); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.