4

I am trying to connect to the Sparx EA project using C# application. For that I have created one C# console application and added Interop.EA.dll as a reference in the project. Following is the code that I am using to connect to the Sparx EA.

r = new EA.Repository();
bool isOpen = r.OpenFile("C:\\Sparx-EA\\Sample Project.eap");

I was expecting that It will open the Sample Project, but instead it is opening New Project dialog to get the new project name/path. When I close that dialog without selecting any project, it is opening the Sample Project.

Is there any mistake I am doing in this code? I don't want to cancel/close the New Project dialog every time I run the program.

I am using Sparx EA 11.1.1111 Trial. Experiencing same behavior while opening the Sparx EA UI. It is first asking for new Project and on close that dialog it is opening the previously opened project.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Niraj Chapla
  • 2,149
  • 1
  • 21
  • 34
  • Could it be that the `Open Project` dialog is opened when you execute `r = new EA.Repository();` already? Or is the dialog appearing when `r.OpenFile()` is executed? – πάντα ῥεῖ Oct 13 '14 at 16:24
  • It is opening dialog while executing line r.OpenFile(). And it is not opening Open Project dialog. It is opening New Project diaolog. – Niraj Chapla Oct 14 '14 at 02:56

1 Answers1

3

I'm unable to reproduce that behavior. The exact and complete code I used:

using System;

namespace EATest {
  class Program {
    public static void Main(string[] args) {
      Console.WriteLine("Hello World!");

      EA.Repository r = new EA.Repository();
      bool isOpen = r.OpenFile("C:\\temp\\Sparx-EA\\Sample Project.eap");
      r.ShowWindow(1);
      Console.Write("Press any key to continue . . . ");
      Console.ReadKey(true);
    }
  }
}

and it opened my project just like I expected. Since this is also happening when you open EA manually I'm guessing there's something else playing here. It could be due to another add-in running. Make sure you disable all add-ins using Extensions|Manage Add-Ins...

If it's not that then I'm guessing there must be something wrong with your EA installation. I suggest you ask Sparx by sending in a bug report

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50