Book a Demo

Author Topic: Enterprise Architect Model, Authors.Count variable is not updated correctly  (Read 5057 times)

mateiacd

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Hi,

I am using Enterprise Architect 12.1.0.1229

I wrote a C# add-in that reads the values of the Repository object, according to the documentation:

http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/availableresources.html
http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/eaadd-insea_menuclick.html

I wrote:

Code: [Select]
  public void EA_MenuClick(Repository repository, string location, string menuName, string itemName)
  {
    MessageBox.Show(repository.Authors.Count.ToString());
  }

When I follow these steps:

1. Open an EAP model
2. Call my Add-in from the menu and notice the value of the Authors.Count variable
3. Add or remove an author by following from the menu:  Project | Settings | Project Types | People > Project Author(s)
4. Call my Add-in again and notice the value of  the Authors.Count variable

You will notice that the two values are identical, which is of course incorrect.



 


« Last Edit: October 08, 2016, 12:17:13 am by mateiacd »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
try
Repository.Authors.Refresh()
to make sure that your collections is up to date before reading the values again.

Geert

mateiacd

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Hi Geert,

Many thanks !! ;D The code below works correctly.

Code: [Select]
public void EA_MenuClick(Repository repository, string location, string menuName, string itemName)
  {
    repository.Authors.Refresh();
    MessageBox.Show(repository.Authors.Count.ToString());
  }