Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

In developing with ArcMap, is there any way to register a service that can be used during the life-cycle of a document- for example to do something like:

C# .NET

mxApplication.RegisterService(myWebService); 

then later-

mxApplication.GetService<WebService>().SaySomething("Hi");

So kind of using the Service Locator pattern or similar.

share|improve this question
    
Just as @blah238 mentioned- found this source that clarifies where/how to coordinate different components. –  leon Nov 28 '12 at 14:00
add comment

1 Answer

up vote 2 down vote accepted

Typically in AO you would use an extension to manage state and listen for the OpenDocument, CloseDocument, etc. events. See the Extension to listen to document open and save events sample for example.

If you need to persist data in the map document itself, see the How to persist data in a document sample.

share|improve this answer
    
Thanks. I created an Extension and publicly declared and initialized objects that tools and menus share as static members. Now I have 'global' access as long as the Extension is loaded. –  leon Nov 27 '12 at 13:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.