public string GetToken() { AuthApi authAPI = new AuthApi(ConnectionSettings.ServerURL); var apiResponse = authAPI.ApiV1AuthTokenPostWithHttpInfo(new LoginModel(ConnectionSettings.AgentUsername, ConnectionSettings.AgentPassword)); Configuration.AccessToken = apiResponse.Data.Token.ToString(); ConfigurationUpdatedEvent?.Invoke(this, Configuration); ConnectionSettings.AgentId = apiResponse.Data.AgentId; return(Configuration.AccessToken); }
public void Initialize(String pEndpoint) { base.Initialize(); Endpoint = pEndpoint; _connection = new HubConnectionBuilder().WithUrl(Endpoint).Build(); _connection.On("RequestRNNPrediction", (PredictionRequestPackage pPackage) => { PredictionRequestedEvent?.Invoke(pPackage); }); _connection.On("UpdateConfig", (ConductorConfiguration pConfig) => { ConfigurationUpdatedEvent?.Invoke(pConfig); }); _connection.Closed += async delegate(Exception arg) { NotifyNewLogMessageEvent("Connection closed... restarting..."); IsConnected = false; await ConnectAsync(); }; }