コード例 #1
0
        /// <summary>
        /// Reset settings object to default values.
        /// </summary>
        /// <typeparam name="T">The type of the settings object.</typeparam>
        /// <param name="settings">The settings object to reset.</param>
        public static void ResetDefault <T>(T settings)
            where T : INotifyPropertyChanged, new()
        {
            var context = new Resetter(settings);

            settings.Serialize(context);
        }
コード例 #2
0
        public override void SerializeChild(string name)
        {
            var property = GetProperty(name);
            var child    = (INotifyPropertyChanged)property.GetValue(Settings);

            if (child == null)
            {
                child = CreateChildValue(property);
            }
            var childContext = new Resetter(child);

            child.Serialize(childContext);

            SetPropertyValue(name, child);
        }