共用方式為


DatastoreManager 類別

更新:2007 年 11 月

存取資料存放區中的資料,並提供方法以列舉及取得桌上型電腦資料存放區中的 Platform 物件。

命名空間:  Microsoft.SmartDevice.Connectivity
組件:  Microsoft.SmartDevice.Connectivity (在 Microsoft.SmartDevice.Connectivity.dll 中)

語法

Public Class DatastoreManager

Dim instance As DatastoreManager
public class DatastoreManager
public ref class DatastoreManager
public class DatastoreManager

備註

這一定是這個命名空間 (Namespace) 中使用的第一個類別 (Class)。

資料存放區包含桌上型電腦上註冊之平台和裝置的相關資訊。如需資料存放區的詳細資訊,請參閱使用智慧型裝置連接 API 控制裝置

範例

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();
    }
}

繼承階層架構

System.Object
  Microsoft.SmartDevice.Connectivity.DatastoreManager

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

請參閱

參考

DatastoreManager 成員

Microsoft.SmartDevice.Connectivity 命名空間