IStreetSmartAPIInit Method |
Initializes the API using the inserted values. Required to use functional PanoramaViewers.
Namespace:
StreetSmart.WinForms.Interfaces
Assembly:
StreetSmart.WinForms (in StreetSmart.WinForms.dll) Version: 18.3.0.0 (18.3.0.0)
SyntaxTask Init(
IOptions options
)
Function Init (
options As IOptions
) As Task
Task^ Init(
IOptions^ options
)
abstract Init :
options : IOptions -> Task
Parameters
- options
- Type: StreetSmart.WinForms.InterfacesIOptions
Object containing the options used for initializing the API.
Return Value
Type:
TaskAsynchronous function
Exceptions
Examples
This sample shows how to use the
Init(IOptions) function.
using System;
using StreetSmart.WinForms.Exceptions;
using StreetSmart.WinForms.Factories;
using StreetSmart.WinForms.Interfaces;
namespace Demo
{
public class Example
{
private IStreetSmartAPI _api;
private System.Windows.Forms.Panel plStreetSmart = new System.Windows.Forms.Panel();
public void StartAPI()
{
_api = StreetSmartAPIFactory.Create();
_api.APIReady += OnAPIReady;
plStreetSmart.Controls.Add(_api.GUI);
}
private async void OnAPIReady(object sender, EventArgs args)
{
IDomElement element = DomElementFactory.Create();
IOptions options = OptionsFactory.Create("myUsername", "myPassword", "myAPIKey", "EPSG:28992", element);
try
{
await _api.Init(options);
}
catch (StreetSmartLoginFailedException ex)
{
}
}
}
}
See Also