<commit_before>﻿/**********************************************************************
 * 
 * Update Controls .NET
 * Copyright 2010 <NAME>
 * MIT License
 * 
 * http://updatecontrols.net
 * http://updatecontrols.codeplex.com/
 * 
 **********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Windows.Threading;
using System.Diagnostics;

namespace Assisticant.XAML.Wrapper
{
    [DebuggerDisplay("ForView.Wrap({_wrappedObject})")]
    [TypeDescriptionProvider(typeof(ClassInstanceProvider))]
    public class ObjectInstance<TWrappedObjectType> : IObjectInstance, INotifyPropertyChanged, IDataErrorInfo, IEditableObject
    {
        // Wrap the class and all of its property definitions.
		private static ClassInstance _classInstance = new ClassInstance(typeof(TWrappedObjectType), typeof(ObjectInstance<TWrappedObjectType>));

        // Wrap the object instance.
        private object _wrappedObject;

        // The dispatcher for the view that I'm attached to.
        private Dispatcher _dispatcher;

		// Wrap all properties.
		private List<ObjectProperty> _properties;

		public ObjectInstance(object wrappedObject, Dispatcher dispatcher)
		{
			_wrappedObject = wrappedObject;
            _dispatcher = dispatcher;

            // Create a wrapper around each property.
            _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList();
		}

        public ClassInstance ClassInstance
        {
            get { return _classInstance; }
        }

        public object WrappedObject<commit_msg>Attach type descriptor to each object instance instead of using attribute.<commit_after>﻿/**********************************************************************
 * 
 * Update Controls .NET
 * Copyright 2010 <NAME>
 * MIT License
 * 
 * http://updatecontrols.net
 * http://updatecontrols.codeplex.com/
 * 
 **********************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Windows.Threading;
using System.Diagnostics;

namespace Assisticant.XAML.Wrapper
{
    [DebuggerDisplay("ForView.Wrap({_wrappedObject})")]
    public class ObjectInstance<TWrappedObjectType> : IObjectInstance, INotifyPropertyChanged, IDataErrorInfo, IEditableObject
    {
        // Wrap the class and all of its property definitions.
		private static ClassInstance _classInstance = new ClassInstance(typeof(TWrappedObjectType), typeof(ObjectInstance<TWrappedObjectType>));

        private static ClassInstanceProvider _classInstanceProvider = new ClassInstanceProvider();

        // Wrap the object instance.
        private object _wrappedObject;

        // The dispatcher for the view that I'm attached to.
        private Dispatcher _dispatcher;

		// Wrap all properties.
		private List<ObjectProperty> _properties;

		public ObjectInstance(object wrappedObject, Dispatcher dispatcher)
		{
			_wrappedObject = wrappedObject;
            _dispatcher = dispatcher;

            // Create a wrapper around each property.
            _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList();

            TypeDescriptor.AddProvider(_classInstanceProvider, this);
		}

        public ClassInstance ClassInstance
        {
            get { return _classInstance; }
        }

        public object WrappedObject
{'fraction_non_alphanumeric': 0.15380233551694675, 'fraction_numerical': 0.0022785531187695814, 'mean_word_length': 3.8575380359612725, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2003588', 'n_tokens_mistral': 885, 'n_tokens_neox': 826, 'n_words': 222}