Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - EXploringEA

Pages: [1] 2 3 ... 11
1
@Geert -
Quote
Yes you can execute public operations on an installed add-in. That is precisely what EA is doing.

When I did my tests (albeit a while ago now) I found that the calling an AddIn from an AddIn loaded a separate instance of the DLL, hence state information (for the EA called AddIn) wasn't present.  Are you saying you could access the instance of the DLL that EA has loaded? I am interested to know more about this please.[/s]

CORRECTION: It has changed and as Geert explains you can create an instance of a class contained within another loaded AddIn and call its public methods.  That will teach me to rely on old (clearly out of date) tests :o

Of course, your approach using an AddIn manager would work as the DLLs would be loaded by the AddIn manager and hence within the same context.


Thanks
Adrian



2
Hi

In response to your queries - this is my understanding (mainly based on some experiments I did a few years ago.  I wrote up in 6 or 7 blogs posts starting with Customising EA, in particular see Calling a running AddIn from a script which was looking at call an AddIn from a script (which could similarly be another AddIn). Another caveat- I assume normally programming and not poking around in system tables to look for entry points, etc!

Is there a way to access (public) functions of one addin inside of another addin?
Yes if you consider your other AddIn is only DLL that can be called and access any public method; HOWEVER this would be as a DLL within the context of the calling AddIn and NOT within the context of EA and an instance of the DLL that it could load separately and which would have its own state other actions resulting from calls from EA to that AddIn. 
CORRECTION: Further to Geerts comments I was curious so rerun some tests and it now looks like EA only loads a single instance of an AddIn DLL. Therefore when creating an instance of a class in the other AddIn it is using the same DLL instance.

FYI: My test consists of 2 addins.  The first has a menu option to call the 2nd and retrieve information (time of day, some counters and context for currently selected item), the 2nd AddIn has a menu option to allow me increase the counters.


Is there a way to raise an EA_MenuClick signal to trigger an addin?
No, this is an EA event and cannot be initiated from an AddIn action

can i then also call an addin on them (through the menu)?
You can dynamically provide AddIn menu options.

However, it would be useful to get a better idea of what you are want to do rather than assume it has to be multiple AddIns as there is probably a way to design an AddIn that would fulfill your needs.

Hope this helps.
Adrian



3
General Board / Creating / coding a c# windows application in EA
« on: September 19, 2018, 04:48:13 am »
Hi,

I have been exploring producing a C# Windows applications using EA, unfortunately the documentation seems a bit light in this area and hence I'd like to check with others who may have succeeded (or not)!

I have used the Model wizard to create a c# windows app.  It produces a package with form classes, with source code, project files, etc (all just copied a zip file), plus scripts.  So I can use the scripts to build and run the solution - OK. However, I am curious and want to check that I am not missing anything that can help beyond a trivial example.

So if, for example, I want to add more code to produce a real application, e.g. another dialog:-

1. Adding another form / class.
I create a diagram using Win32UI MDG for a dialog but it looks like I can only export a .rc file (c++) so no good (directly) for a c# project.  Therefore, I assume I need to create the 2 classes (assuming I want to view the form - which looks like I can only do in VS or similar) for my form and then type the code for the "form" and its "designer".  This means that it's only relationship to the EA screen design object will be a link (realisation) between these classes and the dialog.

2. Editing project/solution/resources
When adding classes there doesn't seem to be a mechanism to view/edit the project (and other) files to add a new class.  Hence I assume I need to edit these files (.csproj, .sln, .settings, assembly files) outside of EA.

The same issue exists when working on a class library (e.g. an EA Addin). I can produce and edit all the classes fine within EA however there doesn't appear to be a mechanism to create the project/settings/resource files?


So just to check.
  • Are my observations correct
  • Is the pattern just a "noddy" example, using predefined code without the potential for extension
  • EA doesn't provide support for coding a real c# windows application

Perhaps somebody who has done real code development of windows apps within EA may have some experience/comments on EA's capabilities that I have missed. Are there other development tools/addins besides VS / Sharpdevelop that are useful for code development with EA?

Many thanks
Adrian


4
Not entirely clear what you are wanting to do.
If you want to launch a specific instance of the EA application programatically you can use  the microsoft ProcessStartInfo Class. For example, in VB.net the following will launch the .exe you specify.


Dim p As New Process
p.StartInfo.FileName = "C:\Program Files (x86)\Sparx Systems\EA\ea.exe" ' filename of specific EA .exe so could point to a different directory which has a different version
p.StartInfo.Arguments = "C:\Users\EXploringEA\Downloads\123.eap" 'e.g. filename of eap
Dim hasItStarted = p.Start()

This will launch the required version of EA and assuming its completely OK for different versions to coexist this should be fine.  I did a quick test and all seemed to work OK, but best ask sparx to confirm multiple versions are OK and there is no potential crossover.

Hope this helps.

5
Yes - uses the diagram.diagramobjects then for each of the diagramobjects use the ElementID to access the element object and its properties

6
I had this requirement sometime ago and used EA_OnNotifyContextItemModified but this doesn't let you know if this is due to a tagged value change. 

Hence, my approach was to use EA_OnContextItemChanged to track the selection of an element, and take a copy of tagged values before any changes.  Then when ContextItemModified is triggered a check can be made to see if there is any difference for a tagged value.  Not ideal.. 


7
Hi

Github for Installation Inspector is on the EXploringEA site and is https://github.com/EXploringEA/EAInstallationInspector
(Note: the code on GitHub is for V4 - not the current development release)

Regarding you problem can you post the contents of your cmd file that you have found doesn't work and I can take a look.

Regards
Adrian

8
Further to Helmut's post - I have a newer version of the tool which can provide additional information e.g. Registry Tree view which may help.  For details and download link go to http://tools.exploringea.co.uk/index.php?n=EaInspector.Development.




9
Helmut,

Seems like a valid experiment rather than pure luck, and fortunate that you got a meaningful message!

All makes sense as loading the AddIn DLL is exactly what EA does.

Good to have a logical reason (and test).

BR

Adrian


10
Hi Helmut

Thanks for the information - I'd better make a note of this for future reference.  It is something I would never have thought about - what gave you the clue or was it just luck you found the solution?

BR
Adrian

11
Hi Helmut

Reading your post I have a vague recollection of a similar issue years ago where I ended up having to sign a DLL, but then miraculously the problem just disappeared after a few days so I didn't explore further.

Also, it wasn't clear from your post whether the problem happens on the same machine and for same users or not.

Thinking about what it could be:

If this isn't for a single user/machine my guess would be that it is related to some windows policy.  On taking a quick look Windows local security policy supports rule based actions for DLL's with AppLocker.  In this case it may be worth a look there to see if any rules configured for users / admin.  But a word of warning this is not an area where I have personally done a lot, I'm just aware of cases working with different systems where administrators have set machine/user policies that caused us issues.

Be interested to know the outcome.

BR

Adrian


12
Rich,

Don't be put off by the "youngsters", I started using Excel VBA with EA in 2002, then later used VB.NET (At the time Java was my preference but couldn't get it to work with EA then; not sure where it is now).  Done a lot with EA and Excel including the XL part of eaDocX in VB.Net so know it is fit for purpose!

For some projects, where an off-the-shelf solution doesn't provide the functionality and dynamic interactions with Excel are not required I have used libraries both my own and the EPPlus open-source Excel library.  The later is a file based solution so useful for reading and creating /export Excel workbooks; it also avoids the need for the Excel Interop and the challenges that can present.

Adrian


13
Hi Rich,

Yes.

As pointed out it's not the language that's the issue with writing an AddIn - C+,C#, VB.net  - anything that can create a valid DLL.  In my experience writing AddIns is more about understanding the EA API and dealing with the quirks of windows.

BTW: These days I write nearly all my AddIns in VB.Net unless my customer specifically wants another language, although I'd probably draw the line at doing it in assembly language these days!

If it would help I'm sure I can provide some example VB.net projects including installers - what type of stuff are you trying to do?

Re the error, 800401F3 that is nothing to do with the language; the error message translates to Invalid class string, so this looks like your AddIn DLL isn't registered or name is not correct.  Suggest you download my free Installation Inspector as that may provide a bit of information.  V5 of the installer is in Beta but may be more useful as it includes registry search functions that may help find any mismatch between class name and the class names in your dll file.

I also have some information/examples on registration/installation on the public part of my tools site that may be of interest. As suggested by Uffe Wix works fine and worth getting a good working template sorted early on. 

And as you've probably guessed there are plenty of experts on the forum always ready to help.

Adrian




14
Hi Helmut

Thanks for feature requests:

Item 1:  is now available in the test release (I've put a copy of the working development version DEVc).  You can either select the progID in the registry tree window (context menu) if the progID exists or select the query tab; press the Run query button (at bottom of the form), then type whatever ProgID / classname you wish to check, then press "Run query" - and wait; the query happens in the background (a query active label appears top RH), so you can carry on doing other stuff then return to the query window when query info text box goes green.  BTW: This is not limited to EA but will execute a query for any class.  You could enter a classID but an unlikely request; can be done from context menu options in the registry tree view.

I need to refine the UI and help file but in the meantime have updated V5 concept page with some more screenshots/descriptions.

Item 2:  Seems like this is a request to inspect an installer (msi) file and determine what rights will be required - have I understood your request correctly, if not perhaps you can expand - there may be bits that can be done if not all.  I am guessing that if it is I need to do some more research:-)  It may be as quick to just try!

@all addin developers.

Any more requests? ideas that could make it more useful.
 
thanks

Adrian

15
Ever curious, I've had a play and can confirm that I find no way of dragging something from the EA UI onto a custom contol; no surprise as the control is a child with no clear link back to the EA UI code.  In fact, it's clear from the error message "There is no current diagram to perform this operation. Please select a diagram first" 

However, not sure what you application is, so this may be completely out of scope, but what you can do is track the context e.g. the last item selected in the project browser and click in the tab and capture the information relating to the relevant project browser object.  One could argue that it is easier in some ways that drag and drop i.e. -> click & click!  There are probably several variants of this approach depending on your specific requirements.

Adrian

Pages: [1] 2 3 ... 11