Partager via


StorageDevice.BeginOpenContainer Method

Begins the process for opening a StorageContainer containing any files for the specified title.

Namespace: Microsoft.Xna.Framework.Storage
Assembly: Microsoft.Xna.Framework.Storage (in microsoft.xna.framework.storage.dll)

Syntax

public IAsyncResult BeginOpenContainer (
         string displayName,
         AsyncCallback callback,
         Object state
)

Parameters

  • displayName
    Type: String
    A constant human-readable string that names the file.
  • callback
    Type: AsyncCallback
    An AsyncCallback that represents the method called when the operation is complete.
  • state
    Type: Object
    A user-created object used to uniquely identify the request, or null.

Return Value

The IAsyncResult used to determine when the asynchronous request is finished.

Exceptions

Exception type Condition
ArgumentNullException displayName is null.
InvalidOperationException A container is already open for the PlayerIndex set in BeginShowSelector. A new container cannot be opened until all previous containers used by this PlayerIndex are disposed.

Remarks

After the container is opened, changes to the files within the container are cached until the container is disposed. For this reason, only one container per profile can be opened concurrently on the same device.

If the storage device is removed or the Xbox 360 console is powered down before the container is disposed, any changes are lost.

Call the Dispose method to dispose a StorageContainer.

See Also

Overview

Working with Asynchronous Methods in XNA Game Studio

Reference

StorageDevice Class
StorageDevice Members
Microsoft.Xna.Framework.Storage Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP