Files
ShrlAlgoToolkit/WPFluent/Services/ISnackbarService.cs
2025-04-24 20:56:44 +08:00

46 lines
1.6 KiB
C#

using System.Windows.Controls;
using WPFluent.Controls;
namespace WPFluent;
/// <summary>
/// Represents a contract with the service that provides global <see cref="Snackbar"/>.
/// </summary>
public interface ISnackbarService
{
/// <summary>
/// Provides direct access to the <see cref="ContentPresenter"/>
/// </summary>
/// <returns><see cref="Snackbar"/> currently in use.</returns>
SnackbarPresenter? GetSnackbarPresenter();
/// <summary>
/// Sets the <see cref="SnackbarPresenter"/>
/// </summary>
/// <param name="contentPresenter">
/// <see cref="ContentPresenter"/> inside of which the snackbar will be placed. The new <see cref="Snackbar"/> will
/// replace the current <see cref="ContentPresenter.Content"/>.
/// </param>
void SetSnackbarPresenter(SnackbarPresenter contentPresenter);
/// <summary>
/// Shows the snackbar. If it is already visible, firstly hides it for a moment, changes its content, and then shows it
/// again.
/// </summary>
/// <param name="title">Name displayed on top of snackbar.</param>
/// <param name="message">Message inside the snackbar.</param>
/// <param name="Appearance">Display style.</param>
/// <param name="icon">Additional icon on the left.</param>
/// <param name="timeout">The time after which the snackbar should disappear.</param>
void Show(string title, string message, ControlAppearance appearance, IconElement? icon, TimeSpan timeout);
/// <summary>
/// Gets or sets a time for which the <see cref="Snackbar"/> should be visible. (By default 2 seconds)
/// </summary>
TimeSpan DefaultTimeOut { get; set; }
}