共用方式為


Guide.BeginShowMessageBox Method (PlayerIndex, String, String, Generic IEnumerable, Int32, MessageBoxIcon, AsyncCallback, Object)

Begins the process of displaying a message box for a particular player.

Syntax

'Declaration
Public Shared Function BeginShowMessageBox ( _
         player As PlayerIndex, _
         title As String, _
         text As String, _
         buttons As IEnumerable(Of String), _
         focusButton As Integer, _
         icon As MessageBoxIcon, _
         callback As AsyncCallback, _
         state As Object _
) As IAsyncResult 
public static IAsyncResult BeginShowMessageBox (
         PlayerIndex player,
         string title,
         string text,
         IEnumerable<string> buttons,
         int focusButton,
         MessageBoxIcon icon,
         AsyncCallback callback,
         Object state
)
public:
static IAsyncResult BeginShowMessageBox(
         PlayerIndex player,
         String title,
         String text,
         IEnumerable<String> buttons,
         int focusButton,
         MessageBoxIcon icon,
         AsyncCallback callback,
         Object state
)

Parameters

  • player
    Type: PlayerIndex
    Target player of the message box. On Windows Phone, the only valid option is PlayerIndex.One.
  • title
    Type: String
    Title of the message box.
  • text
    Type: String
    Text that will be displayed by the message box.
  • buttons
    Type: IEnumerable<String>
    Captions for the message box buttons. The maximum number of buttons is two on Windows Phone.
  • focusButton
    Type: Int32
    Zero-based index specifying which button has the focus.
  • icon
    Type: MessageBoxIcon
    Type of icon displayed in the message box.
  • callback
    Type: AsyncCallback
    Method to be called once the asynchronous operation has finished.
  • state
    Type: Object
    User-created object uniquely identifying this request.

Return Value

Type: IAsyncResult
An IAsyncResult used to track the progress of the method.

Exceptions

Exception type Condition
InvalidOperationException Either IsInitialized was not called previously, or a Guide user interface screen currently is active.

Remarks

This overload requires that the player for whom the message is targeted responds to the message.

Bb975191.bp(en-us,XNAGameStudio.42).gifBest Practice

You can check GamerPrivileges.AllowCommunication to determine if a player is allowed to send and receive communications before displaying a menu option that would call this method.

Requirements

Namespace: Microsoft.Xna.Framework.GamerServices

Assembly: Microsoft.Xna.Framework.GamerServices (in microsoft.xna.framework.gamerservices.dll)

See Also

Tasks

Displaying a Message Box
Working with Asynchronous Methods in XNA Game Studio

Reference

Guide Class
Guide Members
Microsoft.Xna.Framework.GamerServices Namespace

Platforms

Windows Phone