public static ResourceChangedSender GetSender(ResourceItem resourceFile, bool isDeleted = false, ResourceData oldResourceData = null) { if (ResourceChangedFactory.senderCollection.ContainsKey(resourceFile)) { return((ResourceChangedSender)ResourceChangedFactory.defaultEmptySender); } ResourceChangedSender resourceChangedSender = new ResourceChangedSender(resourceFile, isDeleted, oldResourceData); ResourceChangedFactory.senderCollection[resourceFile] = resourceChangedSender; resourceChangedSender.Disposed += new Action <ResourceChangedSender, ResourceItem>(ResourceChangedFactory.Sender_Disposed); return(resourceChangedSender); }
private static void Sender_Disposed(ResourceChangedSender obj, ResourceItem e) { obj.Disposed -= new Action <ResourceChangedSender, ResourceItem>(ResourceChangedFactory.Sender_Disposed); ResourceChangedFactory.senderCollection.Remove(e); }