1

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.

1
  • Just as @blah238 mentioned- found this source that clarifies where/how to coordinate different components.
    – leon
    Commented Nov 28, 2012 at 14:00

1 Answer 1

2

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.

1
  • 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
    Commented Nov 27, 2012 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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