Using and distributing custom web controls – Pitney Bowes MapXtreme User Manual

Page 90

Advertising
background image

Chapter 5: Web Applications, Controls, and Tools

Using and Distributing Custom Web Controls

MapXtreme v7.1

90

Developer Guide

MapInfo.WebControls.MapControlModel controlModel =

MapControlModel.SetDefaultModelInSession();

controlModel.Commands.Add(new AddPinPointCommand());

10. Add the tool to the Visual Studio toolbox by creating a new assembly. See

Using and

Distributing Custom Web Controls

.

11. Drag and drop the custom tool onto the web form and set the properties to the names of the

ClientCommand and ClientInteraction, as set forth in your JavaScript from steps 3and 4.

12. Set the property for the server Command, as defined in step 6.

13. Register the tag prefix in the web form by specifying the assembly and namespace in which this

control exists.
<%@ Register TagPrefix="cc1" Namespace="MapInfo.WebControls"
Assembly="MapInfo.WebControls, Version=4.0.0.476, Culture=neutral,
PublicKeyToken=0a9556cc66c0af57" %>
<%@ Page language="c#" Inherits="ToolsSample.WebForm1"
CodeFile="WebForm1.aspx.cs" %>
<%@ Register TagPrefix="cc2" Namespace="CustomizedWebTools" %>

If the existing behaviors of the WebTool do not meet your needs, you can write your own server
Command class and Javascript to handle client-side commands and interactions. See

Adding an

InfoTool to a Web Application

for an example.

Using and Distributing Custom Web Controls

Once you have created a custom web tool, you must include it in an assembly so that it is available
in the Visual Studio toolbox or to distribute to others.

MapXtreme provides the source code for our Web controls so you can learn from them, modify
them, and distribute them as you need. The source code for the Web controls is installed in the
\Samples\WebControlsSourceCode folder. In order to use and distribute the modified web controls,
you must create a new assembly and register it in Visual Studio.

Whether you modify the MapXtreme source code or create your own tool class from scratch,
consider the following important factors regarding the MapXtreme web control assembly.

The assembly name is MapInfo.WebControls.dll and is installed in the global assembly cache.
This assembly has a specific version number which is used by our templates and sample
applications.

The controls in the assembly are installed in the toolbox in Visual Studio.

The assembly has references to MapInfo.CoreEngine.dll, MapInfo.CoreEngine.Wrapper.dll and
MapInfo.CoreTypes.dll.

Resources such as images and scripts are installed in the C:\Program Files\Common
Files\MapInfo\MapXtreme\7.x.x\MapXtremeWebResources folder.

Advertising