/// <summary> /// Initializes this <see cref="IScriptProbeAgent"/>. This is called when the <see cref="IProtocol"/> associated with /// this <see cref="IScriptProbeAgent"/> is started. /// </summary> /// <param name="sensusServiceHelper">A reference to the Sensus helper.</param> /// <param name="protocol">A reference to the <see cref="IProtocol"/> associated with this <see cref="IScriptProbeAgent"/>.</param> public async Task InitializeAsync(ISensusServiceHelper sensusServiceHelper, IProtocol protocol) { _sensusServiceHelper = sensusServiceHelper; _protocol = protocol; // download the initial policy try { await _protocol.UpdateScriptAgentPolicyAsync(CancellationToken.None); } catch (Exception ex) { _sensusServiceHelper?.Logger.Log("Exception while downloading the policy: " + ex.Message, LoggingLevel.Normal, GetType()); } _sensusServiceHelper?.Logger.Log("Agent has been initialized.", LoggingLevel.Normal, GetType()); }