Loading your extension – Pitney Bowes MapXtreme User Manual
Page 480

Appendix B: Customizing MapXtreme
Workspace Manager Extensions
MapXtreme v7.1
487
Developer Guide
System.Windows.Forms.TabControl MainTabControl{get;}
ContextMenuStrip MapContextMenu{get;}
ContextMenuStrip LegendContextMenu{get;}
ContextMenuStrip GenericTabContextMenu{get;}
}
Event Handling
If your extension needs to receive event notifications from Workspace Manager, add a class that
implements the IWorkspaceManagerNotifications interface and returns it from the Load() method.
Workspace Manager calls this class when a workspace is created, loaded, or saved.
public interface IWorkspaceManagerNotifications
{
void OnNewWorkspace();
void OnWorkspaceLoaded(WorkSpaceLoader workspaceLoader, string
filename);
void OnWorkspaceSaving(WorkSpacePersistence workspacePersistence,
string filename);
void OnWorkspaceSaved(string filename);
void OnLayerControlDialog(MapInfo.Windows.Dialogs.LayerControlDlg
dlg);
}
Loading Your Extension
Your Workspace Manager extension can be loaded from the Extensions > Load Extension menu
command. The Open dialog displays where you can navigate to the location of your assembly.
Use the provided Extension Manager dialog to show the loaded and unload extensions. This is
reachable from the Extensions > Manage Extensions command. It can invoke a properties dialog if
one is available.
Loading an Extension from In-memory Assemblies
Extensions can also be autoloaded. On startup, Workspace Manager looks for extensions to load in
two places.
First, it scans all of the assemblies already loaded into the current AppDomain to see if any types
implement IWorkspaceManager. This is an advanced scenario and the only likely case for using it is
if an SessionEventHandler (see
) happens to also contain a Workspace
Manager extension.
Second, Workspace Manager looks in a folder called Extensions in the sample location as
WorkspaceManager.exe. The assembly must be named
<my_extension>.WorkspaceManagerExtension.dll. All extension assemblies in this
location are loaded into the same AppDomain as Workspace Manager.