/// <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;
        }
示例#2
0
 /// <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();
 }