/// <summary> /// Called by all classes that wish to alert all listeners for NavigateEvent that navigation has occurred. /// </summary> /// <param name="state">The current state.</param> public static void InvokeEventHandlers(State state) { if(NavigateEvent != null) { NavigateEventArgs navigateArgs = new NavigateEventArgs(state); NavigateEvent(null, navigateArgs); } }
/// <summary> /// Creates a NavigateEventArgs object that contains the state. /// </summary> /// <param name="state">State of the task.</param> public NavigateEventArgs(State state) { _state = state; }
/// <summary> /// Stores the state in the StateCache. /// </summary> /// <param name="state">The state to be cached.</param> /// <param name="trackResurection">Indicates when to stop tracking the object. If true, the object is tracked after finalization; if false, the object is tracked only until finalization.</param> public static void PutStateInCache(State state, bool trackResurection) { //Get expiration configuration CacheConfiguration cacheConfig = UIPConfiguration.Config.GetCacheConfiguration(); // Create a new StateCacheEntry object using the existing state object and cache configuration CacheEntry stateCache = CreateCacheEntry(cacheConfig.Mode, cacheConfig.Interval, new WeakReference(state, trackResurection)); // PUT IT IN Cache, we manage State Cache in State Factory... // as with all other concrete Factory implementations... lock (_stateCache.SyncRoot) { _stateCache[state.TaskId] = stateCache; Debug.Assert((_stateCache[state.TaskId] == stateCache), "Cache object DID NOT contain StateCacheEntry just added to it.", ""); } }
/// <summary> /// Saves state to the Session object. /// </summary> /// <param name="inState">The state to save.</param> public void Save(State inState) { // put State object directly into Session HttpContext.Current.Session[ inState.TaskId.ToString() ] = inState; }