ESRI.ArcGIS.Mobile
MobileService Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.Mobile.MobileServices Namespace : MobileService Class

OBSOLETE - MobileService stores the layer data that has been retrieved from an ArcGIS Mobile Server to a local disk file.

Object Model








Syntax

Visual Basic (Declaration) 
<EditorBrowsableAttribute(EditorBrowsableState.Never)>
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="ESRI.ArcGIS.Mobile.Designer.MobileServiceDesigner, ESRI.ArcGIS.Mobile.Designer, Culture=neutral")>
<DesignerCategoryAttribute("code")>
<ObsoleteAttribute()>
<ToolboxItemAttribute(ToolboxItemType=, ToolboxItemTypeName="")>
Public Class MobileService 
   Inherits MobileCache
   Implements IBoundable, ISpatialData2 
C# 
[EditorBrowsableAttribute(EditorBrowsableState.Never)]
[DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="ESRI.ArcGIS.Mobile.Designer.MobileServiceDesigner, ESRI.ArcGIS.Mobile.Designer, Culture=neutral")]
[DesignerCategoryAttribute("code")]
[ObsoleteAttribute()]
[ToolboxItemAttribute(ToolboxItemType=, ToolboxItemTypeName="")]
public class MobileService : MobileCache, IBoundable, ISpatialData2  

Example

The following examples show both methods to create and use the MobileService.
Visual BasicCopy Code
'Method 1: Access MobileService via Map
Dim myMap As New ESRI.ArcGIS.Mobile.Map
Dim panMapAction As New ESRI.ArcGIS.Mobile.PanMapAction
myMap.CurrentMapAction = panMapAction

Dim myMobileService As New ESRI.ArcGIS.Mobile.MobileService
myMobileService.StoragePath = "c:\\temp\\MapData"
myMobileService.Url = "http://tyranus/arcgis/services/Redlands/MapServer/MobileServer"
myMap.MobileService = myMobileService

If (myMobileService.Exists) Then
    myMobileService.Delete()
End If

myMobileService.Create()
myMobileService.Open()

Controls.Add(myMap)

myMap.Location = New System.Drawing.Point(0, 0)
myMap.Size = Me.Size

myMobileService.GetDataAsync(myMap, True, System.DBNull.Value)
C#Copy Code
// Method 1: Access MobileService via Map 
Map myMap = new Map(); 
PanMapAction panMapAction = new PanMapAction(); 
myMap.CurrentMapAction = panMapAction; 
  
MobileService myMobileService = new MobileService(); 
myMobileService.StoragePath = "c:\\temp\\dasfasdf"; 
myMobileService.Url = "http://tyranus/arcgis/services/Redlands/MapServer/MobileServer"; 
myMap.MobileService = myMobileService; 
  
if (myMobileService.Exists) 
  myMobileService.Delete(); 
  
myMobileService.Create(); 
myMobileService.Open(); 
  
Controls.Add(myMap); 
  
myMap.Location = new System.Drawing.Point(0, 0); 
myMap.Size = this.Size; 
  
myMobileService.GetDataAsync(myMap, true, null); 
  
// Method 2: Access local MobileService through FileOpenDialog 
ESRI.ArcGIS.Mobile.Map myMap = new ESRI.ArcGIS.Mobile.Map(); 
ESRI.ArcGIS.Mobile.PanMapAction panMapAction = new ESRI.ArcGIS.Mobile.PanMapAction(); 
myMap.CurrentMapAction = panMapAction; 
  
Controls.Add(myMap); 
myMap.Location = new System.Drawing.Point(4, 4); 
myMap.Size = this.Size; 
  
ESRI.ArcGIS.Mobile.MobileService myMobileService = new ESRI.ArcGIS.Mobile.MobileService(); 
FolderBrowserDialog myFolderBrowserDlg = new FolderBrowserDialog(); 
  
if (myFolderBrowserDlg.ShowDialog() == DialogResult.OK) 

  myMobileService.StoragePath = myFileOpenDlg.SelectedPath; 
  myMap.MobileService = myMobileService; 
  myMobileService.Open(); 

    

Remarks

The Map displays data from an ArcGIS map service via the MobileService. The MobileService manages the connection to the map service and stores the retrieved data on a local disk file, thus reducing the number of requests to the server for map content.

You access the MobileService through the Map.MobileService property. Alternatively, you can create a MobileService object and associate it to the Map via the same property, which is useful if you have multiple map controls reading the same MobileService.

The connection from the MobileService to the ArcGIS Server map service is specified by the MobileService.Url property. The location of the MobileService file on disk is specified by the MobileService.StoragePath property. If the MobileService file doesn't already exist in local drive, MobileService.Create should be called to create local MobileService file with schema defined in ArcGIS Server map service.

Before the MobileService could be consumed by a Map control, MobileService.Open needs to be called to open the MobileService for use. Use IsOpen property to check the status of the MobileService.

Once connected, data is retrieved from the map service via the MobileService.GetDataAsync or the MobileService.GetFeatureDataAsync, GetAnnotationDataAsync, GetRasterDataAsync methods. These methods should be called explicitly within the ExtentChanged event of the Map Control or in other places where necessary so that new data would be retrieved when map extent changes.

When a MobileService file is open, it will be locked for reading/writing purposes. This implies that, if there is a need to delete the MobileService file, you need to explicitly call MobileService.Close method to close the MobileService and unlock the file, followed by MobileService.Delete method.

After the MobileService is closed, the physical file remain intact and is reusable by calling Open method later on.

Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         ESRI.ArcGIS.Mobile.DataSource
            ESRI.ArcGIS.Mobile.MobileServices.MobileCache
               ESRI.ArcGIS.Mobile.MobileServices.MobileService

Requirements

Namespace: ESRI.ArcGIS.Mobile.MobileServices

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

Assembly: ESRI.ArcGIS.Mobile (in ESRI.ArcGIS.Mobile.dll)

See Also