Method StartAsync
StartAsync()
Asynchronously creates a LocalMapService based on the Map Package referenced by the Path property.
Declaration
public override Task StartAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous start operation. |
Overrides
Remarks
The StartAsync() method will perform various checks to ascertain the status of both the LocalMapService instance and the underlying LocalServer:
- First the LocalServerStatus of the LocalMapService instance will be ascertained. In the cases that it is already LocalServerStatus.Started or LocalServerStatus.Starting the method will exit. If the LocalMapService creation failed, the current status will be LocalServerStatus.Failed, and an InvalidOperationException will be thrown.
- The status of the LocalServer will then be confirmed. If the status is LocalServerStatus.Initialized the LocalMapService creation will continue. In the cases that the LocalServer is LocalServerStatus.NotInitialized or LocalServerStatus.Initializing an attempt will be made to start the LocalServer and execution will wait until the status is LocalServerStatus.Initialized at which point the attempt to create the LocalMapService will be remade. The status will also be LocalServerStatus.Failed if the StartAsyncTask method is called whilst the LocalServer is shutting down. If the underlying LocalServer encountered an error and failed to initialize correctly an exception will be raised.
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Windows | 100.13 - 200.5 |
.NET Framework | 100.0 - 200.5 |
StartAsync(CancellationToken)
Asynchronously creates a LocalMapService based on the Map Package referenced by the Path property.
Declaration
public override Task StartAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous start operation. |
Overrides
Remarks
The token to monitor for cancellation requests. The default value is System.Threading.CancellationToken.None.
The StartAsync(CancellationToken) method will perform various checks to ascertain the status of both the LocalMapService instance and the underlying LocalServer:
- First the LocalServerStatus of the LocalMapService instance will be ascertained. In the cases that it is already LocalServerStatus.Started or LocalServerStatus.Starting the method will exit. If the LocalMapService creation failed, the current status will be LocalServerStatus.Failed, and an InvalidOperationException will be thrown.
- The status of the LocalServer will then be confirmed. If the status is LocalServerStatus.Initialized the LocalMapService creation will continue. In the cases that the LocalServer is LocalServerStatus.NotInitialized or LocalServerStatus.Initializing an attempt will be made to start the LocalServer and execution will wait until the status is LocalServerStatus.Initialized at which point the attempt to create the LocalMapService will be remade. The status will also be LocalServerStatus.Failed if the StartAsyncTask method is called whilst the LocalServer is shutting down. If the underlying LocalServer encountered an error and failed to initialize correctly an exception will be raised.
Exceptions
Type | Condition |
---|---|
System.Threading.Tasks.TaskCanceledException | The operation was cancelled |
Applies to
Platforms and versions
Target | Versions |
---|---|
.NET Windows | 100.13 - 200.5 |
.NET Framework | 100.13 - 200.5 |