Exemple #1
0
 /// <summary>
 /// Saves the state of the specified object key.
 /// </summary>
 public void SaveState(string objectKey)
 {
     SaveAndRestoreActions stateObject = stateObjects[objectKey];
     ObjectState objState = new ObjectState();
     objState.StateObjectKey = objectKey;
     objState.States = stateObject.GetState();
     appState.ObjectStates = (List<ObjectState>)appState.ObjectStates.Replace(objState, (a, b) => (a.StateObjectKey == b.StateObjectKey));
 }
Exemple #2
0
        /// <summary>
        /// Save the state of all persistable objects.
        /// </summary>
        public void SaveAllStates()
        {
            appState = new ApplicationState();

            stateObjects.ForEach(kvp =>
                {
                    ObjectState objState = new ObjectState();
                    objState.StateObjectKey = kvp.Key;
                    objState.States = kvp.Value.GetState();
                    appState.ObjectStates.Add(objState);
                });
        }