IStreetSmartAPIInit Method

Initializes the API using the inserted values. Required to use functional PanoramaViewers.

Definition

Namespace: StreetSmart.Common.Interfaces.API
Assembly: StreetSmart.WinForms (in StreetSmart.WinForms.dll) Version: 24.7.0.0+cc0a01953d1235087ce28d3e921f5bb47d3c0460
C#
Task Init(
	IOptions options
)

Parameters

options  IOptions
Object containing the options used for initializing the API.

Return Value

Task
Asynchronous function

Example

This sample shows how to use the Init(IOptions) function.
C#
using System;
using StreetSmart.Common.Exceptions;
using StreetSmart.Common.Factories;
using StreetSmart.Common.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)
    {
      // The dom element within the api must be rendered.
      IDomElement element = DomElementFactory.Create();

      // The initialisation options of the api.
      IOptions options = OptionsFactory.Create("myUsername", "myPassword", "myAPIKey", "EPSG:28992", element);

      try
      {
        // Initialize the api.
        await _api.Init(options);
        // Todo: add functionality
      }
      catch (StreetSmartLoginFailedException ex)
      {
        // login failed exception (ex)
      }
    }
  }
}

Exceptions

StreetSmartLoginFailedExceptionThrown when the login is failed

Version Information

Supported in: 18.7

See Also