/// <summary> /// Starts a new session. /// </summary> public void StartSession() { EventRecord startRecord = new EventRecord { EventName = "SessionStarted", EventTime = DateTime.Now }; this.LogSessionEvent(startRecord); this.session = new Session { StartTime = DateTime.Now }; this.timeOutTimer.Start(); this.OnSessionStarted(); this.currentState = new ApplicationState { Name = "StartState" }; }
/// <summary> /// Goes to specified state in the current session. /// </summary> /// <param name="targetState">The state to go to.</param> public void GoToState(ApplicationState targetState) { EventRecord stateChangeRecord = new EventRecord { EventName = "StateChanged", EventTime = DateTime.Now, Metadata = new Dictionary<string, object> { { "PreviousState", this.currentState.Name }, { "CurrentState", targetState.Name } } }; this.LogSessionEvent(stateChangeRecord); this.previousState = this.currentState; this.currentState = targetState; this.OnStateChanged(); }