/// <summary> /// Bonjour callback - cleanup removed services /// </summary> /// <param name="browser"></param> /// <param name="service"></param> /// <param name="moreComing"></param> private void didRemovePlayers(NetServiceBrowser browser, NetService service, bool moreComing) { // First remove from list of known players/streamers/archivers ArrayList list = getList(service.Type); if (list == null) return; ArrayList itemsToRemove = new ArrayList(); lock (list.SyncRoot) { foreach (JSONSrcSink player in list) { if (player.id.Equals(service.Name)) { itemsToRemove.Add(player); break; } } if (itemsToRemove.Count > 0) { foreach (JSONSrcSink player in itemsToRemove) list.Remove(player); itemsToRemove.Clear(); return; } } // now remove the services if (service.Type.StartsWith(Shared.DisplayCastGlobals.PLAYER) || service.Type.StartsWith(Shared.DisplayCastGlobals.ARCHIVER)) lock(sinkServices.SyncRoot) sinkServices.Remove(service); if (service.Type.StartsWith(Shared.DisplayCastGlobals.STREAMER)) lock (sourceServices.SyncRoot) sourceServices.Remove(service); service.Stop(); }