public void RetrieveProcessedQueueItems(TimeSpan timeSpan) { if (_mgr.MonitorQueues.Length == 0) { return; } List <QueueItem> items = new List <QueueItem>(); // TODO: Solve why we can not iterate thru Remote MQ, // both GetMessageEnumerator2() and GetAllMessages() should be available for // Remote computer and direct format name, but returns zero (0) messages always //if( !Tools.IsLocalHost(_serverName) ) // return; DateTime since = DateTime.Now - timeSpan; foreach (QueueType t in Enum.GetValues(typeof(QueueType))) { if (_monitorState.MonitorQueueType[(int)t]) { var r = _mgr.GetProcessedMessages(t, since, _items.AsEnumerable <QueueItem>()); items.AddRange(r.Items); } } bool changed = false; lock ( _itemsLock ) { // Add new items foreach (var itm in items) { if (!_items.Any(i => i.Id == itm.Id)) { _items.Add(new QueueItemViewModel(itm, _mgr.MessagesHasMilliSecondPrecision)); if (!changed) { changed = true; } } } } if (changed) { _items.Sort((a, b) => b.ArrivedTime.CompareTo(a.ArrivedTime)); OnItemsChanged(ItemChangeOrigin.Queue); } }