public static ITelemetryClient CreateMats(
            IApplicationConfiguration applicationConfiguration,
            IPlatformProxy platformProxy,
            ITelemetryConfig telemetryConfig)
        {
            string dpti = platformProxy.GetDevicePlatformTelemetryId();

            if (!IsDeviceEnabled(telemetryConfig.AudienceType, dpti))
            {
                return(null);
            }

            string deviceNetworkState = platformProxy.GetDeviceNetworkState();
            int    osPlatformCode     = platformProxy.GetMatsOsPlatformCode();

            bool         enableAggregation = true;
            IEventFilter eventFilter       = new EventFilter(enableAggregation);
            var          errorStore        = new ErrorStore();
            var          scenarioStore     = new ScenarioStore(TimeConstants.ScenarioTimeoutMilliseconds, errorStore);

            var allowedScopes = new HashSet <string>();

            // TODO: need to determine what MATS was doing with the AllowedScopes and DeniedScopes values in the C++ impl
            // and possibly expose this value in the ITelemetryConfig interface.
            //if (telemetryConfig.AllowedScopes != null)
            //{
            //    foreach (string s in telemetryConfig.AllowedScopes)
            //    {
            //        allowedScopes.Add(s);
            //    }
            //}

            var actionStore = new ActionStore(
                TimeConstants.ActionTimeoutMilliseconds,
                TimeConstants.AggregationWindowMilliseconds,
                errorStore,
                eventFilter,
                allowedScopes);

            var contextStore = ContextStore.CreateContextStore(
                telemetryConfig.AudienceType,
                applicationConfiguration.ClientName,
                applicationConfiguration.ClientVersion,
                dpti,
                deviceNetworkState,
                telemetryConfig.SessionId,
                osPlatformCode);

            IUploader uploader = new TelemetryUploader(telemetryConfig.DispatchAction, platformProxy, applicationConfiguration.ClientName);

            // it's this way in mats c++
            bool isScenarioUploadDisabled = true;

            return(new TelemetryClient(
                       applicationConfiguration,
                       platformProxy,
                       errorStore,
                       uploader,
                       actionStore,
                       scenarioStore,
                       contextStore,
                       isScenarioUploadDisabled));
        }
 /// <summary>
 /// Generate telemetry aggregation events.
 /// </summary>
 /// <param name="telemetryConfig"></param>
 /// <returns></returns>
 public T WithTelemetry(ITelemetryConfig telemetryConfig)
 {
     Config.TelemetryConfig = telemetryConfig;
     return((T)this);
 }
 public T WithTelemetry(ITelemetryConfig telemetryConfig)
 {
     return((T)this);
 }