예제 #1
0
        public virtual void ExtractPersonalization(Control source)
        {
            if (!this.States.ContainsKey(source.ID))
            {
                this.States.Add(source.ID, new PersonalizationDictionary());
            }

            PersonalizationDictionary personalizations = this.States[source.ID];

            if (source is ITrackingPersonalizable)
            {
                ((ITrackingPersonalizable)source).BeginSave();
            }

            if (source is IPersonalizable)
            {
                ((IPersonalizable)source).Save(personalizations);
            }

            this.FillPersonalizationDictionary(source, PersonalizableAttribute.GetPersonalizableProperties(source.GetType()), personalizations);

            if (source is ITrackingPersonalizable)
            {
                ((ITrackingPersonalizable)source).EndSave();
            }

            if (!this.States.ContainsKey(source.ID))
            {
                this.States.Add(source.ID, personalizations);
            }
        }
예제 #2
0
 public void FillPersonalizationDictionary(Control control, ICollection propertyInfos, PersonalizationDictionary personalizations)
 {
     foreach (PropertyInfo propertyInfo in propertyInfos)
     {
         PersonalizableAttribute attribute = (PersonalizableAttribute)Attribute.GetCustomAttribute(propertyInfo, typeof(PersonalizableAttribute));
         PersonalizationEntry    entry     = new PersonalizationEntry(ReflectionServices.ExtractValue(control, propertyInfo.Name), attribute.Scope, attribute.IsSensitive);
         if (!personalizations.Contains(propertyInfo.Name))
         {
             personalizations.Add(propertyInfo.Name, entry);
         }
         else
         {
             personalizations[propertyInfo.Name] = entry;
         }
     }
 }