public AddressLookupGateway(IAddressLookupClient lookupClient) { this.LookupClient = lookupClient; }
private void AddressLookupClientCompleted (IAddressLookupClient client) { lock (this) { _addressLookupsCompleted.Add (client); if (_addressLookupsCompleted.Count != _addressLookups.Count) return; List<LocationInfo> addresses = new List<LocationInfo> (); _addressLookups.ForEach (al => addresses.AddRange (al.Addresses)); this.FoundAddresses = addresses; _canLookup = true; } // needs to be outside of the lock statement otherwise the actualy handler may just lock up // if invoking on the main thread. A possible mono bug if (this.ClientCompleted != null) this.ClientCompleted (this); }