1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.State
7 using System.Collections.Generic;
8 using System.Diagnostics;
11 // Simple wrapper around a dictionary of CategoryStates keyed by the category names.
13 internal class CategoryStateContainer : PersistedStateContainer
17 // Gets the CategoryState for the specified category. If one does not exist
18 // yet, it will be created automatically, guaranteeing a non-null return value.
20 // <param name="categoryName">Name of the requested category</param>
21 // <returns>A non-null instance of CategoryState</returns>
22 public CategoryState GetCategoryState(string categoryName)
24 return (CategoryState)this.GetState(categoryName);
28 // Creates a default state object based on the specified key
30 // <param name="key">Key of the state object</param>
31 // <returns>Default state object</returns>
32 protected override PersistedState CreateDefaultState(object key)
34 return new CategoryState(key as string);
38 // Deserializes the specified string value into a state object
40 // <param name="serializedValue">Serialized value of the state object</param>
41 // <returns>Deserialized instance of the state object</returns>
42 protected override PersistedState DeserializeState(string serializedValue)
44 return CategoryState.Deserialize(serializedValue);