-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: adding documentation on the Notifications API
- Loading branch information
Showing
10 changed files
with
95 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
uid: Plugins.Essentials.Notifications.ActionSheets | ||
--- | ||
|
||
# ActionSheets | ||
|
||
An ActionSheet presents the user with a set of alternatives for how to proceed with a task. To display an ActionSheet you can use the `IActionSheet` directly or you can use the aggregate `INotifications` interface as follows: | ||
|
||
```cs | ||
await notifications.ActionSheet.DisplayAsync("Send to:", | ||
ActionSheetButton.CreateButton("Email", SendEmail), | ||
ActionSheetButton.CreateButton("Twitter", SendTweet), | ||
ActionSheetButton.CreateButton("Facebook Messenger", SendFacebookMessage)); | ||
``` | ||
|
||
![Simple ActionSheet](images/simple-actionsheet.png) | ||
|
||
ActionSheets also provide the capability to provide an explicit Cancel or Destroy button. |
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,21 @@ | ||
--- | ||
uid: Plugins.Essentials.Notifications.Alerts | ||
--- | ||
|
||
# Alerts | ||
|
||
To display an Alert you can use the `IAlerts` interface directly or through the aggregate service `INotifications` as follows: | ||
|
||
```cs | ||
await notifications.Alert.DisplayAsync("Alert", "You have been alerted"); | ||
``` | ||
|
||
![Simple Alert](images/simple-alert.png) | ||
|
||
The Alert can also be used to prompt a user for a boolean (yes/no) response. | ||
|
||
```cs | ||
await notifications.Alert.DisplayAsync("Question?", "Would you like to play a game", "Yes", "No"); | ||
``` | ||
|
||
![Two Button Alert](images/two-button-alert.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
--- | ||
uid: Plugins.Essentials.Notifications | ||
--- | ||
|
||
# Notifications | ||
|
||
Displaying an alert, asking a user to make a choice, or displaying a prompt is a common UI task. The Notifications API from Prism Essentials is designed as a cross platform replacement API for the PageDialogService in Prism.Forms and Prism.Maui. For those migrating from Prism.Forms it is recommended to migrate to this API as this will better help you to migrate your code to a more future proof API which will work well into the future without the need to change your code should you choose to switch between Uno Platform and .NET MAUI. Additionally this API will be providing support with WPF making your WPF apps easier to migrate to mobile in the future. | ||
|
||
## Getting Started | ||
|
||
To use the Notifications API you must either call `UsePrismEssentials` or `RegisterNotifications`. | ||
|
||
```cs | ||
public class MyViewModel(INotifications notifications) | ||
``` | ||
|
||
## Next Steps | ||
|
||
- [ActionSheets](xref:Prism.Essentials.Notifications.ActionSheets) | ||
- [Alerts](xref:Prism.Essentials.Notifications.Alerts) | ||
- [Prompts](xref:Prism.Essentials.Notifications.Prompts) | ||
|
||
> [!NOTE] | ||
> This is currently only supported on Android, iOS, MacCatalyst, & WinUI for .NET MAUI and Uno Platform. This feature is planned for future expansion to all Uno Platform platforms and WPF. |
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,22 @@ | ||
--- | ||
uid: Plugins.Essentials.Notifications.ActionSheets | ||
--- | ||
|
||
# Prompts | ||
|
||
To display a prompt you can use the `IPrompts` interface directly or the aggregate `INotifications` as follows: | ||
|
||
```cs | ||
var value = await notifications.Prompts.DisplayAsync("Question", "What's your name?"); | ||
``` | ||
|
||
![Simple Prompt](images/simple-prompt.png) | ||
|
||
The Display method also provides additional optional parameters: | ||
|
||
- `accept` - the text for the accept button. | ||
- `cancel` - the text for the cancel button. | ||
- `placeholder` - the placeholder text to display in the user prompt. | ||
- `maxlength` - the max length of the user's response. | ||
- `keyboard` - the keyboard type to use. This is provided via an enum value. | ||
- `initialValue` - a predefined default value for the user to provide. |
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,8 @@ | ||
- name: Getting Started | ||
href: index.md | ||
- name: ActionSheets | ||
href: actionsheets.md | ||
- name: Alerts | ||
href: alerts.md | ||
- name: Prompts | ||
href: prompts.md |
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