DatastoreManager Class

Accesses information in the Datastore and provides methods to enumerate and get Platform objects in the desktop computer's Datastore.

Namespace:  Microsoft.SmartDevice.Connectivity
Assembly:  Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)

Syntax

'Declaration
Public Class DatastoreManager
'Usage
Dim instance As DatastoreManager
public class DatastoreManager
public ref class DatastoreManager
public class DatastoreManager

Remarks

This is always the first class used in this namespace.

The Datastore contains information about platforms and devices registered on the desktop computer. For more information about the Datastore, see the last section in Controlling Devices with the Smart Device Connectivity API.

Examples

Imports System
Imports System.Collections.ObjectModel
Imports Microsoft.SmartDevice.Connectivity

Class Example

    Shared Sub Main(ByVal args() As String)
        ' Get datastore object 
        Dim dsmgr As New DatastoreManager(1033)

        ' Get the platforms in the Datastore 
        Dim platforms As Collection(Of Platform) = dsmgr.GetPlatforms()

        ' For each platform, output name and ID
        Console.WriteLine("Get all platforms with the GetPlatforms method: " + vbCr + vbLf)
        Dim platform As Platform
        For Each platform In platforms
            Console.WriteLine("Platform Name: " + platform.Name + "    ID: " + _
                              platform.Id.ToString())
        Next platform

        ' Get the Windows Mobile 5.0 Smartphone platform 
        Dim wm5sp As New ObjectId(New Guid("BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39"))
        Dim p As Platform = dsmgr.GetPlatform(wm5sp)

        ' Output information
        Console.WriteLine(vbCr + vbLf + vbCr + vbLf + _
                          "Get the WM5 Smartphone platform using the GetPlatform method: " + _
                          vbCr + vbLf)
        Console.WriteLine("Platform Name: " + p.Name + "    ID: " + p.Id.ToString())
        Console.ReadLine()

    End Sub 'Main
End Class 'Example
using System;
using System.Collections.ObjectModel;
using Microsoft.SmartDevice.Connectivity;

class Example
{
    static void Main(string[] args)
    {
        // Get datastore object
        DatastoreManager dsmgr = new DatastoreManager(1033);

        // Get the platforms in the Datastore
        Collection<Platform> platforms = dsmgr.GetPlatforms();


        // For each platform, output name and ID
        Console.WriteLine("Get all platforms with the GetPlatforms method: \r\n");
        foreach (Platform platform in platforms)
        {
            Console.WriteLine("Platform Name: " + platform.Name + "    ID: " + platform.Id);
        }

        // Get the Windows Mobile 5.0 Smartphone platform
        ObjectId wm5sp = new ObjectId(new Guid("BD0CC567-F6FD-4ca3-99D2-063EFDFC0A39"));
        Platform p = dsmgr.GetPlatform(wm5sp);

        // Output information
        Console.WriteLine("\r\n\r\nGet the WM5 Smartphone platform using the GetPlatform method: \r\n");
        Console.WriteLine("Platform Name: " + p.Name + "    ID: " + p.Id);

        Console.ReadLine();
    }
}

Inheritance Hierarchy

System.Object
  Microsoft.SmartDevice.Connectivity.DatastoreManager

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

DatastoreManager Members

Microsoft.SmartDevice.Connectivity Namespace