Пример #1
0
 // <summary>
 // Serializes this object into a simple string (AppDomains like strings).
 //
 // Format: PropertyName,SubPropertiesExpanded;NextPropertyName,SubPropertiesExpanded;...
 // Where bools are recorded as 0 = false and 1 = true
 // </summary>
 // <returns>Serialized version of this state object (may be null)</returns>
 protected override string SerializeCore()
 {
     return(string.Concat(
                PersistedStateUtilities.Escape(_propertyName),
                ',',
                PersistedStateUtilities.BoolToDigit(_subPropertiesExpanded)));
 }
 // <summary>
 // Serializes this object into a simple string (AppDomains like strings).
 //
 // Format: CategoryName,CategoryExpanded,AdvancedExpanded;NextCategoryName,CategoryExpanded,AdvancedExpanded;...
 // Where bools are recorded as 0 = false and 1 = true and ';' and ',' are escaped
 // </summary>
 // <returns>Serialized version of this state object (may be null)</returns>
 protected override string SerializeCore()
 {
     return(string.Concat(
                PersistedStateUtilities.Escape(_categoryName),
                ',',
                PersistedStateUtilities.BoolToDigit(_categoryExpanded),
                ',',
                PersistedStateUtilities.BoolToDigit(_advancedSectionExpanded)));
 }
        // IStateContainer Members

        // <summary>
        // Retrieves all stored IPropertyViewManager types under all persistence IDs
        // </summary>
        // <returns>All stored IPropertyViewManager types under all persistence IDs</returns>
        public object RetrieveState()
        {
            if (_persistenceIdToManagerTypeNameMap == null || _persistenceIdToManagerTypeNameMap.Count == 0)
            {
                return(null);
            }

            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair <string, string> pair in _persistenceIdToManagerTypeNameMap)
            {
                if (sb.Length > 0)
                {
                    sb.Append(';');
                }

                sb.Append(PersistedStateUtilities.Escape(pair.Key));
                sb.Append(';');
                sb.Append(pair.Value);
            }

            return(sb.ToString());
        }