Book a Demo

Author Topic: EA_OnPostInitialized  (Read 3862 times)

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
EA_OnPostInitialized
« on: September 03, 2012, 10:16:44 pm »
Hi guys,

According to the manuals this method 'notifies Add-Ins that the Repository object has finished loading and any necessary initialization steps can now be performed on the object'.

And the repository parameter is described as 'An EA.Repository object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information'.

However, when I implement this method it is called when EA starts, BEFORE I connect to any project. This seems to me to be in stark contrast to the description of the method and parameter. I would expect it to be called after the model has been properly initialized.

Is it just me, or is this weird?

What I am really looking for is a way to get some code executed after EA has loaded the model, but before the user is able to do anything.

Appreciate any help :-)

Cheers
Knut

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPostInitialized
« Reply #1 on: September 03, 2012, 11:55:41 pm »
Yeah, I had my share of issues with those as well.
This is the code I use in the EA Navigator:
      
Code: [Select]
public override void EA_OnPostInitialized(EA.Repository Repository)
      {
            // initialize the model
        this.model = new UTF_EA.Model(Repository);
        if (this.navigatorControl != null)
        {
              this.navigatorControl.clear();
        }
      }
      public override void EA_FileOpen(EA.Repository Repository)
      {
            if (this.navigatorControl != null)
        {
              this.navigatorControl.clear();
        }
        this.fullyLoaded = true;
      }
IIRC EA_OnPostInitialized only launches once when the application is started.
EA_FileOpen launches when a model has been loaded.

Geert

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Re: EA_OnPostInitialized
« Reply #2 on: September 11, 2012, 12:42:51 am »
I am not sure I understand what you are doing here. Why 'override'? and FileOpen? I was under the impression that this was a method I could call to open an eap file repository, not a callback method.

Knut Paulsen

  • EA User
  • **
  • Posts: 82
  • Karma: +1/-0
    • View Profile
Re: EA_OnPostInitialized
« Reply #3 on: September 11, 2012, 04:08:54 pm »
Please ignore my post from yesterday. I don't know what I was thinking about :-)

I just don't understand how I could have missed the file open event.