Пример #1
0
        /// <summary>
        /// Instantiate a VWOClient to call Activate, GetVariation and Track apis for given user and goal.
        /// </summary>
        /// <param name="settingFile">Settings as provided by GetSettings call.</param>
        /// <param name="isDevelopmentMode">When running in development or non-production mode. This ensures no operations are tracked on VWO account.</param>
        /// <param name="batchData">Event batching requestTimeInterval,eventsPerRequest,flushCallback value.</param>
        /// <param name="userStorageService">UserStorageService to Get and Save User-assigned variations.</param>
        /// <param name="goalTypeToTrack">Specify which goalType to track.</param>
        /// <param name="shouldTrackReturningUser">Should track returning user or not.</param>
        /// <param name="integrations">Integration Event Listener onEvent callback</param>
        /// <returns>
        /// IVWOClient instance to call Activate, GetVariation and Track apis for given user and goal.
        /// </returns>
        public static IVWOClient Launch(Settings settingFile, bool isDevelopmentMode = false, IUserStorageService userStorageService = null,
                                        BatchEventData batchData      = null, string goalTypeToTrack    = Constants.GoalTypes.ALL,
                                        bool shouldTrackReturningUser = false, HookManager integrations = null)
        {
            if (Validator.SettingsFile(settingFile))
            {
                LogDebugMessage.ValidConfiguration(file);
                AccountSettings accountSettings = SettingsProcessor.ProcessAndBucket(settingFile);
                LogDebugMessage.SettingsFileProcessed(file);
                if (accountSettings == null)
                {
                    return(null);
                }

                if (isDevelopmentMode)
                {
                    LogDebugMessage.SetDevelopmentMode(file);
                }
                //integration
                var vwoClient = new VWO(accountSettings, Validator, userStorageService, CampaignAllocator, SegmentEvaluator,
                                        VariationAllocator, isDevelopmentMode, batchData, goalTypeToTrack, shouldTrackReturningUser, integrations);
                LogDebugMessage.SdkInitialized(file);
                return(vwoClient);
            }
            LogErrorMessage.ProjectConfigCorrupted(file);
            return(null);
        }
Пример #2
0
        /// <summary>
        /// Instantiate a VWOClient to call Activate, GetVariation and Track apis for given user and goal.
        /// </summary>
        /// <param name="settingFile">Settings as provided by GetSettings call.</param>
        /// <param name="isDevelopmentMode">When running in development or non-production mode. This ensures no operations are tracked on VWO account.</param>
        /// <param name="userProfileService">UserProfileService to Lookup and Save User-assigned variations.</param>
        /// <returns>
        /// IVWOClient instance to call Activate, GetVariation and Track apis for given user and goal.
        /// </returns>
        public static IVWOClient Instantiate(Settings settingFile, bool isDevelopmentMode = false, IUserProfileService userProfileService = null)
        {
            if (Validator.SettingsFile(settingFile))
            {
                LogDebugMessage.ValidConfiguration(file);
                AccountSettings accountSettings = SettingsProcessor.ProcessAndBucket(settingFile);
                LogDebugMessage.SettingsFileProcessed(file);
                if (accountSettings == null)
                {
                    return(null);
                }

                if (isDevelopmentMode)
                {
                    LogDebugMessage.SetDevelopmentMode(file);
                }

                var vwoClient = new VWO(accountSettings, Validator, userProfileService, CampaignAllocator, VariationAllocator, isDevelopmentMode);
                LogDebugMessage.SdkInitialized(file);
                return(vwoClient);
            }
            LogErrorMessage.ProjectConfigCorrupted(file);
            return(null);
        }