Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docfx/articles/core/ALERTDIALOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# AlertDialog

The AlertDialog class provides a fundamental implementation for displaying dialog boxes, like Toast.

## Usage

To use AlertDialog, you need to add a service to your 'Program.cs' file in your Blazor application:

~~~ C#
builder.Services.AddScoped<IAlertDialogService, ToasterService>();
~~~

Next, in your 'MainLayout.razor' file, add the following line for visualization:

~~~ HTML
<AXSharp.Presentation.Blazor.Controls.Dialogs.AlertDialog.Toaster />
~~~

Now you can use the AlertDialog wherever needed. To utilize the AlertDialog in your views or code-behind file, you must inject the 'IAlertDialogService' service:

~~~ C#
[Inject]
private IAlertDialogService _alertDialogService { get; set; }
~~~

Then, you can freely use it, for example, like this:

~~~ C#
_alertDialogService.AddAlertDialog(type, title, message, time);
~~~

Where:

- type: represents the visualization type - Info, Success, Danger, Warning
- title: Refers to the header of your alert
- message: Corresponds to the text in your alert
- time: Specifies the duration in seconds for which the alert will be displayed

### RenderableContentControl

To use AlertDialog in a RenderableComponentBase, you need to add the 'AlertDialogService' property with the current AlertDialogService to the 'RenderableContentControl'. You can obtain the AlertDialogService from the injected service.

~~~ HTML
<RenderableContentControl Context="Vm.Data" Presentation="Display" AlertDialogService="_alertDialogService"></RenderableContentControl>
~~~

RenderableComponentBase has the AlertDialogService property, so in any class that inherits from RenderableComponentBase, you can use the AlertDialogService, for example:

~~~ C#
AlertDialogService.AddAlertDialog("Success", "title", "message", 30);
~~~

## Example

![Alert Dialog](~/images/AlertDialog.png)
3 changes: 2 additions & 1 deletion docfx/articles/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
[!INCLUDE [AxoStep](AXOSTEP.md)]
[!INCLUDE [AxoSequencer](AXOSEQUENCER.md)]
[!INCLUDE [AxoSequencerContainer](AXOSEQUENCERCONTAINER.md)]
[!INCLUDE [AxoComponent](AXOCOMPONENT.md)]
[!INCLUDE [AxoComponent](AXOCOMPONENT.md)]
[!INCLUDE [AlertDialog](ALERTDIALOG.md)]
2 changes: 2 additions & 0 deletions docfx/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
href: ~/articles/core/AXOSEQUENCERCONTAINER.md
- name: AxoComponent
href: ~/articles/core/AXOCOMPONENT.md
- name: AlertDialog
href: ~/articles/core/ALERTDIALOG.md
- name: AXOpen.Data
href: ~/articles/data/README.md
items:
Expand Down
Binary file added docfx/images/AlertDialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.