protected override void OnInitialized() { if (Snackbar != null) { Snackbar.OnUpdate += SnackbarUpdated; Snackbar.Init(); Css = builder => { var transitionClass = Snackbar.State.TransitionClass; if (!IsNullOrWhiteSpace(transitionClass)) { builder.OpenElement(1, "style"); builder.AddContent(2, transitionClass); builder.CloseElement(); } }; } }
public void Remove(Snackbar snackbar) { snackbar.Dispose(); snackbar.OnClose -= Remove; SnackBarLock.EnterWriteLock(); try { var index = SnackBarList.IndexOf(snackbar); if (index < 0) { return; } SnackBarList.RemoveAt(index); } finally { SnackBarLock.ExitWriteLock(); } OnSnackbarsUpdated?.Invoke(); }
protected void CloseIconClicked() => Snackbar?.Clicked(true);
protected void ActionClicked() => Snackbar?.Clicked(false);