/// <summary> /// Removes the next available ephemeral toast from the queue and signifies the the toast scheduler to display it. /// </summary> /// <returns>The dequeued ephemeral toast to be displayed.</returns> public UI.Components.Toast.Toast Dequeue() { var toast = ToastList.FirstOrDefault(); if (toast != null) { ToastList.RemoveAt(0); } DisplayToast = toast; return(toast); }
/// <summary> /// Add a persistent toast to the list, reorders the toast list based on priority level, and displays when available. /// </summary> /// <param name="toast">The persistent toast to display.</param> public void Add(UI.Components.Toast.Toast toast) { ToastList.Add(toast); var newToastList = ToastList.OrderByDescending(x => x.Priority).Take(Size < Capacity ? Size : Capacity).ToList(); // If at capacity, remove obsolete persistent toasts if (AtCapacity) { foreach (UI.Components.Toast.Toast existingToast in ToastList) { if (!newToastList.Contains(existingToast)) { existingToast.RemoveFromElement(); } } } ToastList = newToastList; }
/// <summary> /// Refreshes the text content of all the toasts in the collection. /// </summary> public virtual void RefreshAllContent() { ToastList.ForEach(toast => toast.RefreshContent()); }
/// <summary> /// Adds an ephemeral toast to the queue and reorders the queue based on priority level. /// </summary> /// <param name="toast">The ephemeral toast to add to the queue.</param> public void Add(UI.Components.Toast.Toast toast) { ToastList.Add(toast); ToastList = ToastList.OrderByDescending(x => x.Priority).Take(Size < Capacity ? Size : Capacity).ToList(); }