public void OnRemoteCollectionUpdated(object sender, EventTreeEventArgs e) { UpdateCollection(e.Collection); Action action = () => _collectionUpdatedEvent.Raise(this, e); DispatcherHolder.BeginInvoke(action); }
private void RaiseUnitsUpdatedEvent(TUnit[] units) { try { _unitsUpdated.Raise(this, () => new UnitCollectionEventArgs <TUnit>(units)); } catch (Exception exception) { LoggingProvider.Current.Log(TraceEventType.Error, exception); } }
private void UpdateUnits(IEnumerable <T> units) { List <T> updatedUnits = new List <T>(); lock (_lock) { foreach (T unit in units) { bool newUnit = false; T proxyUnit; if (_dictionaryByUid.TryGetValue(unit.Uid, out proxyUnit)) { proxyUnit.Update(unit.NativeUnit); } else { proxyUnit = Convert(unit); _dictionaryByUid.Add(unit.Uid, proxyUnit); newUnit = true; } updatedUnits.Add(proxyUnit); List <T> theSameIdUnits; if (!_dictionaryById.TryGetValue(proxyUnit.Id, out theSameIdUnits)) { theSameIdUnits = new List <T>(); _dictionaryById.Add(proxyUnit.Id, theSameIdUnits); } theSameIdUnits.Add(proxyUnit); if (newUnit) { _collection.Add(proxyUnit); } } } _unitsUpdatedEvent.Raise(this, () => new UnitCollectionEventArgs <T>(updatedUnits.ToArray())); }
private void RaiseUnitsUpdatedEvent(T[] units) { _unitsUpdated.Raise(this, () => new DaemonUnitCollectionEventArgs <T>(units)); }