Share via


Get a Route

The Get a Route sample is a Pocket PC application that shows how to get two positions and then create a route between them. This application also allows the user to toggle between a map showing the route and turn-by-turn directions.

Running the Sample in Visual Studio .NET 2003

Note    You must install Microsoft® Visual Studio® .NET 2003, the Microsoft .NET Compact Framework version 1.0 with Service Pack 2 (SP2), and have a Pocket PC or a Pocket PC emulator to run this sample.

To run the sample

  1. In Visual Studio .NET, on the File menu, point to New, and then click Project.

  2. In the left pane of the New Project dialog box, click Visual Basic Projects or Visual C# Projects, and then click the Smart Device Application template.

  3. In Name, change SmartDeviceApplication1 to GetRoute, and then click OK.

  4. In the Smart Device Application Wizard dialog box, make sure the following settings are selected:

  5. Platform is set to Pocket PC

  6. Project type is set to Windows Application

  7. On the Project menu, click Add Existing Item.

  8. Navigate to the appropriate project subfolder in the GetRoute folder, select All Files in the Files of type box, and then select all the available files.

    • The default location for Visual Basic .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Pocket PC Samples\GetRoute\vb.
    • The default location for Visual C# .NET project files is:
      Program Files\Microsoft MapPoint Location Server SDK, Version 1.0\Samples\Pocket PC Samples\GetRoute\cs.

    Note  When prompted, replace any existing files.

  9. Delete the default windows form, Form1, from the project.

  10. On the Project menu, click Add Web Reference.

  11. In Address, type the URL for the MapPoint Location Server Web Service WSDL (similar to https://your-domain/your-path/LocationServer.wsdl), and then press ENTER.

  12. When the WSDL appears, click Add Reference.

  13. In Solution Explorer, right-click the Web reference, and then click Rename.

  14. Rename the Web reference to MapPointLocationServer.

  15. Right-click the GettingRoute.cs or GettingRoute.vb file, and then click View Code.

  16. Search for and replace the following items with your personal information:

  17. Search for user-name and replace it with your alias.

  18. Search for user-password and replace it with your domain password.

  19. Search for user-domain and replace it with your domain name.

  20. On the Debug menu, click Start.

  21. When the application is deployed and loaded onto your Pocket PC or Pocket PC emulator, enter a start address in Start text box (for example, Chicago, IL) and a finish address in Finish text box (for example, Redmond, WA), and then click Get Directions .

  22. You can toggle between the full-route map and the turn-by-turn directions using the From/To and Directions tabs located at the bottom-left corner of the form.

See Also

Sample Code