private void InsertItem(SnackbarMessageQueueItem item) { lock (_snackbarMessagesLock) { var added = false; var node = _snackbarMessages.First; while (node != null) { if (!IgnoreDuplicate && item.IsDuplicate(node.Value)) { return; } if (item.IsPromoted && !node.Value.IsPromoted) { _snackbarMessages.AddBefore(node, item); added = true; break; } node = node.Next; } if (!added) { _snackbarMessages.AddLast(item); } } _dispatcher.InvokeAsync(ShowNextAsync); }
private void InsertItem(SnackbarMessageQueueItem item) { var node = _snackbarMessages.First; while (node != null) { if (!IgnoreDuplicate && item.IsDuplicate(node.Value)) { return; } if (item.IsPromoted && !node.Value.IsPromoted) { _snackbarMessages.AddBefore(node, item); return; } node = node.Next; } _snackbarMessages.AddLast(item); }