Overview

We recommend that you maintain a Windows (desktop) version of your mobile application. By doing so, you will experience:

  • a more productive development environment
  • faster and more effective debugging
  • simple deployment for both platforms
Note

GeoBase desktop and GeoBase mobile share a large codebase, so developing for both platforms is much easier than it sounds. Most source-code files from your solution can be shared between the desktop and mobile projects, with little or no changes required. For a list of differences between GeoBase desktop features and GeoBase mobile features, see Mobile-specific features.

Creating the Desktop Project

Launch Visual Studio and create a new project (File | New Project).

Note

GeoBase Mobile applications should target the .NET 3.5 Framework, because Microsoft removed support for Smart Device Projects in when they introduced the .NET 4.0 Framework. This means that you cannot use Visual Studio 2010 or later.

This first project will be the desktop version of our application, so select a Windows Forms Application.

mobile guidelines 001

Name the project and solution appropriately; it's suggested that you include "Desktop" in the project name to identify this project as the desktop version of our application.

Creating the Mobile Project

Right-click the solution in Solution Explorer and add a new project (Add | New Project).

mobile guidelines 002

Select the appropriate options to create a Smart Device Project.

mobile guidelines 003

When naming this project it's suggested that you include "Mobile" in the project name to distinguish this project from the desktop project.

Referencing GeoBase Mobile DLLs

GeoBase mobile applications require three supporting DLLs:

  1. geobase.drawing.dll
  2. geobase.mobile.dll
  3. geobase.mobile.net.dll

You can ensure that your application finds these supporting DLLs by placing all three DLLs in the same folder as your application's executable. Visual Studio can perform this action automatically when deploying your application to a device.

First, we must add the DLL files to the project.

Right-click 'My Application - Mobile' (or the equivalent name of your mobile project) in 'Solution Explorer' and select Add | Existing Item. Locate geobase.drawing.dll, geobase.mobile.dll and geobase.mobile.net.dll and click 'Add'.

Tip

You'll need to set the 'Objects of Type' drop-down menu to 'Executable Files' so that the 'Add Existing Item' dialog box can 'see' the DLL files.

Locate the three DLLs in 'Solution Explorer':

mobiledeployment copy 1

For all three DLLs:

  1. Right-click the DLL and select 'Properties'
  2. In the 'Properties' pane set 'Copy to Output Directory' to 'Copy if newer'

We must also add a code reference to GeoBase Mobile. Do this now by:

  1. right-clicking your mobile project's 'References' group in 'Solution Explorer'
  2. Select 'Add Reference...'
  3. Locate geobase.mobile.net.dll and click 'OK'
Tip

To easily locate the appropriate geobase.mobile.net.dll select the 'Browse' tab and browse to C:\My Application\My Application - Mobile (or the equivalent directory for your mobile project). geobase.mobile.net.dll should be visible in this directory.

Note

You do not need to repeat this process for geobase.mobile.dll and geobase.drawing.dll.

Adding New Files

We now have a Visual Studio solution with two projects. One project will be maintained as the desktop version of our application, the other project will be maintained as the mobile version of our application.

To add a new file to our projects we'll first add it to the solution, then reference the file from each project. As an example, we'll add a new source file to our projects.

  1. Right-click the solution in 'Solution Explorer'. Add a new file (Add | New Item), of type 'Visual C# Class' and name the file Main.cs.

  2. The new file will appear in 'Solution Explorer', under 'Solution Items'.

  3. Right-click each project in 'Solution Explorer' and choose to add an existing file (Add | Existing File). Browse to the solution directory and locate Main.cs.

  4. Right-click 'Solution Items' in 'Solution Explorer' and select 'Remove'. This will not delete our new source file, but will tidy up our view of the solution.

If you now browse to your solution directory, you'll see that Main.cs now appears.

mobile guidelines 004

By giving your controls (such as MapCtrl) identical names in both (desktop and mobile) versions of your application you can reuse your source files between projects.