/// <summary>
        /// Apply properties value to class instance from dictionary backup data.
        /// </summary>
        internal virtual void AppllyPropertiesData(Dictionary <string, object> propertiesData)
        {
            Type type = this.GetType();

            foreach (string propertyName in propertiesData.Keys)
            {
                PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public);
                if (property.GetType().IsSubclassOf(typeof(PropertyClonableClass)))
                {
                    PropertyClonableClass value = property.GetValue(this, null) as PropertyClonableClass;
                    value.AppllyPropertiesData(propertiesData[propertyName] as Dictionary <string, object>);
                }
                else
                {
                    property.SetValue(this, propertiesData[propertyName], null);
                }
            }
        }
Пример #2
0
 private void button_cancel_Click(object sender, EventArgs e)
 {
     _configInst.AppllyPropertiesData(_originalPropertyData);
     this.Dispose();
 }