Esempio n. 1
0
        /// <summary>
        /// Creates a new session and adds it to the beacon sender. The top level action count is reset to zero and the
        /// last interaction time is set to the current timestamp.
        /// <para>
        /// In case the given <code>initialServerConfig</code> is not null, the new session will be initialized with
        /// this server configuration. The created session however will not be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be performed for
        /// this session.
        /// </para>
        /// <para>
        /// In case the given <code>updatedServerConfig</code> is not null, the new session will be updated with this
        /// server configuration. The created session will be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be omitted.
        /// </para>
        /// </summary>
        /// <param name="initialServerConfig">
        /// the server configuration with which the session will be initialized. Can be <code>null</code>
        /// </param>
        /// <param name="updatedServerConfig">
        /// the server configuration with which the session will be updated. Can be <code>null</code>.
        /// </param>
        private void CreateAndAssignCurrentSession(IServerConfiguration initialServerConfig,
                                                   IServerConfiguration updatedServerConfig)
        {
            var session = sessionCreator.CreateSession(this);
            var beacon  = session.Beacon;

            beacon.OnServerConfigurationUpdate += OnServerConfigurationUpdate;

            ThisComposite.StoreChildInList(session);

            lastInteractionTime = beacon.SessionStartTime;
            topLevelActionCount = 0;

            if (initialServerConfig != null)
            {
                session.InitializeServerConfiguration(initialServerConfig);
            }

            if (updatedServerConfig != null)
            {
                session.UpdateServerConfiguration(updatedServerConfig);
            }

            lock (lockObject)
            {
                // synchronize access
                currentSession = session;
            }

            beaconSender.AddSession(currentSession);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new session and adds it to the beacon sender. The top level action count is reset to zero and the
        /// last interaction time is set to the current timestamp.
        /// <para>
        /// In case the given <code>initialServerConfig</code> is not null, the new session will be initialized with
        /// this server configuration. The created session however will not be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be performed for
        /// this session.
        /// </para>
        /// <para>
        /// In case the given <code>updatedServerConfig</code> is not null, the new session will be updated with this
        /// server configuration. The created session will be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be omitted.
        /// </para>
        /// </summary>
        /// <param name="initialServerConfig">
        /// the server configuration with which the session will be initialized. Can be <code>null</code>
        /// </param>
        /// <param name="updatedServerConfig">
        /// the server configuration with which the session will be updated. Can be <code>null</code>.
        /// </param>
        /// <returns>the newly created session.</returns>
        private ISessionInternals CreateSession(IServerConfiguration initialServerConfig,
                                                IServerConfiguration updatedServerConfig)
        {
            var session = sessionCreator.CreateSession(this);
            var beacon  = session.Beacon;

            beacon.OnServerConfigurationUpdate += OnServerConfigurationUpdate;

            ThisComposite.StoreChildInList(session);

            lastInteractionTime = beacon.SessionStartTime;
            topLevelActionCount = 0;

            if (initialServerConfig != null)
            {
                session.InitializeServerConfiguration(initialServerConfig);
            }

            if (updatedServerConfig != null)
            {
                session.UpdateServerConfiguration(updatedServerConfig);
            }

            beaconSender.AddSession(session);

            return(session);
        }