using WPFluent.Controls;
namespace WPFluent.Extensions;
///
/// Extensions for the .
///
public static class SnackbarServiceExtensions
{
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
public static void Show(this ISnackbarService snackbarService, string title, string message)
{ snackbarService.Show(title, message, ControlAppearance.Secondary, null, snackbarService.DefaultTimeOut); }
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
/// Display style.
public static void Show(
this ISnackbarService snackbarService,
string title,
string message,
ControlAppearance appearance)
{ snackbarService.Show(title, message, appearance, null, snackbarService.DefaultTimeOut); }
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
/// Additional icon on the left.
public static void Show(this ISnackbarService snackbarService, string title, string message, IconElement icon)
{ snackbarService.Show(title, message, ControlAppearance.Secondary, icon, snackbarService.DefaultTimeOut); }
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
/// The time after which the snackbar should disappear.
public static void Show(this ISnackbarService snackbarService, string title, string message, TimeSpan timeout)
{ snackbarService.Show(title, message, ControlAppearance.Secondary, null, timeout); }
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
/// Display style.
/// The time after which the snackbar should disappear.
public static void Show(
this ISnackbarService snackbarService,
string title,
string message,
ControlAppearance appearance,
TimeSpan timeout)
{ snackbarService.Show(title, message, appearance, null, timeout); }
///
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows
/// it again.
///
/// The .
/// Name displayed on top of snackbar.
/// Message inside the snackbar.
/// Additional icon on the left.
/// The time after which the snackbar should disappear.
public static void Show(
this ISnackbarService snackbarService,
string title,
string message,
IconElement icon,
TimeSpan timeout)
{ snackbarService.Show(title, message, ControlAppearance.Secondary, icon, timeout); }
}