protected override bool OnUpdateFrom(Device newDevice, List <string> updatedPropertyNames) { var isUpdated = UpdateValue(() => CreatedAt, newDevice, updatedPropertyNames); isUpdated = UpdateValue(() => Id, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => LastSeenAt, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Name, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Platform, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => PlatformVersion, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => ProductVersion, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Provides, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => PublicAddress, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => ScreenDensity, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => ScreenResolution, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Token, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Vendor, newDevice, updatedPropertyNames) | isUpdated; isUpdated = UpdateValue(() => Version, newDevice, updatedPropertyNames) | isUpdated; foreach (var connection in Connections.ToList().Where(con => newDevice.Connections.All(c => c.Uri != con.Uri))) { Connections.Remove(connection); isUpdated = true; } foreach (var connection in newDevice.Connections.Where(con => Connections.All(c => c.Uri != con.Uri))) { Connections.Add(connection); isUpdated = true; } return(isUpdated); }
internal async Task UpdateNowPlaying(List <Video> nowPlaying) { await Task.Run(() => { try { lock (_syncObj) { _videosNowPlaying.StopEvents = true; // first delete all that are not playing foreach (var video in _videosNowPlaying.ToList()) { RemoveIfRequired(nowPlaying, video); } // now add all new ones or update foreach (var video in nowPlaying) { AddOrUpdateVideo(video); } } } finally { _videosNowPlaying.StopEvents = false; } }); }
public AutolootViewModel() { if (!File.Exists(_propertiesFile)) { return; } LoadProperties(); LoadCustomProperties(); AutolootHelpers.SetAutolootContainer = serial => ContainerSerial = serial; IncomingPacketHandlers.CorpseContainerDisplayEvent += OnCorpseContainerDisplayEvent; AutolootManager.GetInstance().GetEntries = () => _items.ToList(); }