SavingToast
Description
The SavingToast component is a specialized utility that wraps the standard Toast component to provide standardized feedback for background operations. It simplifies displaying "Saving...", "Saved", and "Error" states with appropriate icons and colors, ensuring consistent user experience across the application for asynchronous tasks.
Usage
Instantiate the SavingToast with an initial message. Call the Saving(), Saved(), or Error() methods to update the toast's state. The component handles the duration and styling for each state automatically.
API reference
public class SavingToastA toast variant that shows a "saving…" indicator while a long operation is running, swapping to success / error feedback when it completes.
- Namespace
- Tesserae
Constructors
| Name | Description |
|---|---|
| SavingToast | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| MinimumDisplayTime | Gets or sets the minimum display time. |
Methods
| Name | Description |
|---|---|
| Saving | Configures the component to saving. |
| Saved | Configures the component to saved. |
| Error | Gets or sets the validation error message displayed beneath the component. |
public SavingToast Saving(string message = null, string title = "Saving...")Configures the component to saving.
public SavingToast Saved(string message = null, string title = "Saved")Configures the component to saved.
public static class SavingToastHelperExtension helpers for awaiting a Task while showing a SavingToast.
- Namespace
- Tesserae
Methods
| Name | Description |
|---|---|
| WithSavingToast | Awaits the given task while displaying a SavingToast: the toast shows a "saving" indicator while the task is in flight and swaps to a "saved" or "error" message on completion. |
| Overload | |
|---|---|
| WithSavingToast<T>(Task<T>, string, string, string) | Awaits the given task while displaying a SavingToast: the toast shows a "saving" indicator while the task is in flight and swaps to a "saved" or "error" message on completion. |
| WithSavingToast(Task, string, string, string) | Returns the component configured with the given saving toast. |
WithSavingToast<T>(Task<T>, string, string, string)
public static async Task<T> WithSavingToast<T>(this Task<T> task, string savingMessage = "Saving...", string savedMessage = "Saved", string errorMessage = "Error")Awaits the given task while displaying a SavingToast: the toast shows a "saving" indicator while the task is in flight and swaps to a "saved" or "error" message on completion.
Parameters
- task Task<T>
- savingMessage string
- savedMessage string
- errorMessage string
WithSavingToast(Task, string, string, string)
public static async Task WithSavingToast(this Task task, string savingMessage = "Saving...", string savedMessage = "Saved", string errorMessage = "Error")Returns the component configured with the given saving toast.
Parameters
- task Task
- savingMessage string
- savedMessage string
- errorMessage string