private void btnImport_Click(object sender, EventArgs e) { const string warnMessage = "Importing the standard CC libraries will overwrite all existing:\n\n" + " - ENUM libraries named \"ENUMLibrary\",\n" + " - PRIM libraries named \"PRIMLibrary\",\n" + " - CDT libraries named \"CDTLibrary \", and \n" + " - CC libraries named \"CCLibrary\"\n\n" + "Are you sure you want to proceed?"; const string caption = "VIENNA Add-In Warning"; DialogResult dialogResult = MessageBox.Show(warnMessage, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialogResult == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; btnClose.Enabled = false; btnImport.Enabled = false; string bLibraryGuid = eaRepository.GetTreeSelectedPackage().Element.ElementGUID; Package bLibrary = eaRepository.GetPackageByGuid(bLibraryGuid); ResourceDescriptor resourceDescriptor = new ResourceDescriptor(cclPath, cbxMajor.SelectedItem.ToString(), cbxMinor.SelectedItem.ToString()); LibraryImporter importer = new LibraryImporter(eaRepository, resourceDescriptor); importer.StatusChanged += OnStatusChanged; importer.ImportStandardCcLibraries(bLibrary); btnImport.Enabled = true; btnClose.Enabled = true; Cursor.Current = Cursors.Default; } }
public void TestImportStandardCcLibrariesIntoEmptyBusinessLibrary() { Repository eaRepository = new TemporaryFileBasedRepository(new EARepositoryLibraryImporter()); var bLibrary = eaRepository.Resolve <Package>((Path)"Test Model 1" / "bLibrary"); DeleteDownloadDirectory(); var importer = new LibraryImporter(eaRepository, resourceDescriptor); importer.ImportStandardCcLibraries(bLibrary); AssertEmptyStandardCcLibrariesInBusinessLibrary(eaRepository, "Test Model 1", "bLibrary"); AssertStandardCcLibrariesContentInBusinessLibrary(eaRepository, "Test Model 1", "bLibrary"); AssertNonExistenceOfBieLibrariesinBusinessLibrary(eaRepository, "Test Model 1", "bLibrary"); }