Creating a web assembly – Pitney Bowes MapXtreme User Manual

Page 91

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

Using and Distributing Custom Web Controls

MapXtreme v7.1

91

Developer Guide

The following files are used by the Web controls:

*.GIF images that represent tool actions (for example, DistanceToolControlActive,
DistanceToolControlInactive).

*.BMP images that represent tool icons (for example, label, selection arrow)

JavaScript defining tool interactions and behaviors (Interaction.js, Command.js,
LayerControl.js, LegendControl.js and Tool.js)

*.CUR (cursor) files that display images when the mouse is used.

Creating a Web Assembly

To create a custom web control assembly:

1. Copy the customized web control source files to another directory so the original is preserved.

2. Remove the original assembly from the global assembly cache and from the Visual Studio

toolbox.
The assemblies are located in C:\Progiram Files\Windows\Assembly\GAC_32 or GAC_64,
depending on if you installed the 32- or 64-bit MapXtreme.

3. Create a strongly named key file (.snk) using sn - k MapInfo.WebControls.snk and copy

this key file to the main project folder (same level as the project files).

4. Change the AssemblyInfo.cs or AssemblyInfo.vb file to reflect the version number of your web

assembly.

5. Open the project in Visual Studio, make any changes you need and build the project. The new

assembly should be in the bin\Release directory so you can distribute the release version of the
assembly.

6. Register your new assembly in the global assembly cache, and in the Visual Studio toolbox using

the following syntax as a model. For more information see

Global Assembly Cache Tool.

gacutil /i MapInfo.WebControls.dll

7. Write your application using the new assembly. Drag and drop the new controls onto your form

from the Visual Studio toolbox.

8. In the installer for your Web application, make sure the new assembly is installed in the global

assembly cache. As long as the Web application points to this version of the assembly, it will use
the new controls.

Consider the following scenarios:

You can insert the Web controls project and resources right into your Web application solution. In
this case, change the URLs for your resources (scripts and images) to begin with the project
root. This prevents you from having to create virtual directories.

You do not have to use the global assembly cache and a strongly named assembly. You can set
the Copy property for the assembly to true, and have the assembly in the bin folder of your
application.

Advertising