static internal void ImportXML(string strRepositoryFullPath, string strPathToFile, string strFileName) { UCRepoClassLibrary.EAImporter theEAImporter; UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(Program.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); if (theEAImporter.Open(strRepositoryFullPath) != 0) { Console.WriteLine("."); Console.WriteLine("Import failed."); return; } int iErrorCount = theEAImporter.ImportXMLFile(strPathToFile, strFileName); Console.WriteLine("."); if (iErrorCount == 0) { Console.WriteLine("Import completed successfully"); } else { Console.WriteLine("Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); }
private void ImportXML_Click(object sender, EventArgs e) { UCRepoClassLibrary.EAImporter theEAImporter; string strPath; richTextBox1.Clear(); richTextBoxErrors.Clear(); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myLogMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogMsg); UCRepoClassLibrary.EAImporter.LogMsgCallbackType myErrorMsgCallback = new UCRepoClassLibrary.EAImporter.LogMsgCallbackType(this.FormLogError); theEAImporter = new UCRepoClassLibrary.EAImporter(myLogMsgCallback, myErrorMsgCallback); string strRepositoryFullPath = textBoxEAFile.Text; theEAImporter.Open(strRepositoryFullPath); strPath = _strUserResourcesFolder + @"\FilledInTemplates"; int iErrorCount = theEAImporter.ImportXMLFile(strPath, listBox2.Text); if (iErrorCount == 0) { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import completed successfully"); } else { UCRepoClassLibrary.EAImporter.LogMsg(UCRepoClassLibrary.EAImporter.LogMsgType.Info, "Import ABORTED. Errors found. Error count=" + iErrorCount.ToString()); } theEAImporter.Close(); Form1_Load(sender, e); // refresh screen }