SimulationManager.StartAsync Method

Starts a simulation asynchronously.

Syntax

public:
static IAsyncAction^ StartAsync(
         SimulationType simulationType,
         SimulationProfile simulationProfile
)  

Parameters

simulationType
Type: SimulationType 

The type of simulation to start. Currently the only valid value is SimulationType.Network.

simulationProfile
Type: SimulationProfile 

The simulation profile to run.

Return value

Type: IAsyncAction 

Returns an IAsyncAction object that represents the state of the asynchronous operation.

Remarks

Only one simulation may be running at any given time. If startAsync is called when a simulation is running, the error code 0x8000000d “An illegal state change was requested.” will be returned. Note that the limitation that only one simulation may be running applies both to this API and to the network simulations started with the xbStress command line tool (i.e xbStress simulate network=avg or xbstress simulate=channels). That is, if a simulation is started using xbStress, calls to SimulationManager::startAsync will fail with “An illegal state change was requested.”

See Network stress for more information on network simulation.

Example

var XtfSimulationManager = Microsoft.Xbox.Tools.ConsoleExtensions.SimulationManager;      
var networkSim = Microsoft.Xbox.Tools.ConsoleExtensions.SimulationType.network;
var netSimProfile = Microsoft.Xbox.Tools.ConsoleExtensions.SimulationProfile.networkMinimum;

XtfSimulationManager.startAsync(networkSim, netSimProfile).then(

    function complete() {
        // Handle success here
        writeLog("SimulationManager.startAsync succeeded");
    }.bind(this),

    function error(e) {
        // If e is “An illegal state change was requested” a simulation was already running when startAsync was called 
        writeError("SimulationManager.startAsync error: ", e);
}.bind(this)

);  

C++

Microsoft::Xbox::Tools::ConsoleExtensions::SimulationType simType = Microsoft::Xbox::Tools::ConsoleExtensions::SimulationType::Network;
Microsoft::Xbox::Tools::ConsoleExtensions::SimulationProfile simProfile = Microsoft::Xbox::Tools::ConsoleExtensions::SimulationProfile::NetworkMinimum;
Microsoft::Xbox::Tools::ConsoleExtensions::SimulationManager::StartAsync(simType,simProfile)->Completed =
ref new Windows::Foundation::AsyncActionCompletedHandler(
[ this ] ( Windows::Foundation::IAsyncAction^ action, Windows::Foundation::AsyncStatus asyncStatus )
{
  if( asyncStatus == Windows::Foundation::AsyncStatus::Completed )
  {
    OutputDebugStringW(L"ERA Console API call succeeded: SimulationManager::StartAsync\r\n");
  }
  else
  {
    OutputDebugStringW(L"ERA Console API call failed: SimulationManager::StartAsync\r\n");
  }
});  

Requirements

Namespace: Microsoft.Xbox.Tools.ConsoleExtensions

Metadata: microsoft.xbox.tools.consoleextensions.winmd

See also

Network stress

Reference

SimulationManager Class

SimulationManager Members

Microsoft.Xbox.Tools.ConsoleExtensions Namespace