Author Topic: Close EA application  (Read 4262 times)

aviv

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Close EA application
« on: September 03, 2014, 06:56:13 pm »
Is it possible to close EA opened application, using c# and EA API?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13247
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Close EA application
« Reply #1 on: September 03, 2014, 08:51:33 pm »
Check the Repository class. There are operations such as closeFile() and Exit()

Geert

aviv

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Close EA application
« Reply #2 on: September 03, 2014, 09:35:19 pm »
Quote
Check the Repository class. There are operations such as closeFile() and Exit()

Geert

Thank.
I've tried them both, but no result.
May it is since I do not use it via an addin?

This is how I get the opened EA application via my stand-alone application:  
Code: [Select]
EA.App EAApplication;
EA.Repository repository;
EAApplication = Microsoft.VisualBasic.Interaction.CreateObject("EA.App","") as EA.App;
if (EAApplication != null)
     repository = EAApplication.Repository;
  

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Close EA application
« Reply #3 on: September 04, 2014, 06:01:44 pm »
Run EA application:
Code: [Select]
ProcessStartInfo processInfo = new ProcessStartInfo( eaInstallationPath, @"Path\to\model.EAP");
processInfo.Verb = "runas";
var process = Process.Start(processInfo);
int pid = process.Id;

Close THIS EA application
Code: [Select]
Process []GetPArry = Process.GetProcesses();
foreach(Process testProcess in GetPArry)
   {
    if (testProcess.Id == pid)
     {
       testProcess.Kill();
      break;
      }
    }
« Last Edit: September 04, 2014, 06:03:28 pm by avoda234 »

aviv

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Close EA application
« Reply #4 on: September 04, 2014, 07:28:27 pm »
Thank you all for the efficient help!