public void Add(string bstrImport) { if (!_importsList.IsPresent(bstrImport)) { _threadingService.ExecuteSynchronously(() => { return(_projectAccessor.OpenProjectXmlForWriteAsync(_unconfiguredProjectVSServices.Project, project => { project.AddItem(ImportItemTypeName, bstrImport); })); }); OnImportAdded(bstrImport); } else { throw new ArgumentException(string.Format("{0} - Namespace is already imported", bstrImport), nameof(bstrImport)); } }
public void Add(string bstrImport) { if (!_importsList.IsPresent(bstrImport)) { _threadingService.ExecuteSynchronously(async() => { using (var access = await _lockService.WriteLockAsync()) { var project = await access.GetProjectAsync(ConfiguredProject).ConfigureAwait(true); await access.CheckoutAsync(project.Xml.ContainingProject.FullPath).ConfigureAwait(true); project.AddItem(importItemTypeName, bstrImport); } }); OnImportAdded(bstrImport); } else { throw new ArgumentException(string.Format("{0} - Namespace is already imported", bstrImport), nameof(bstrImport)); } }