Share via


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

解説

これは常に、この名前空間で使用される最初のクラスです。

データストアには、デスクトップ コンピュータに登録されているプラットフォームとデバイスに関する情報が格納されています。データストアの詳細については、「スマート デバイス接続 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

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

参照

参照

DatastoreManager メンバ

Microsoft.SmartDevice.Connectivity 名前空間