<commit_before>﻿namespace JDunkerley.AlteryxAddIns.Framework.ConfigWindows
{
    using System;
    using System.Windows.Forms;
    using System.Xml;

    using AlteryxGuiToolkit.Plugins;

    /// <summary>
    /// Simple Property Grid Based Configuration Panel
    /// </summary>
    /// <typeparam name="T">Configuration Object</typeparam>
    /// <seealso cref="System.Windows.Forms.UserControl" />
    /// <seealso cref="AlteryxGuiToolkit.Plugins.IPluginConfiguration" />
    public class PropertyGridGui<T> : UserControl, IPluginConfiguration
        where T: new()
    {
        /// <summary>
        /// The _property grid
        /// </summary>
        private readonly PropertyGrid _propertyGrid;

        /// <summary>
        /// The old parent.
        /// </summary>
        private Control _currentParent;

        /// <summary>
        /// The configuration
        /// </summary>
        private T _config;

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyGridGui{T}"/> class.
        /// </summary>
        public PropertyGridGui()
        {
            this.Margin = new Padding(4);
            this.Size = new System.Drawing.Size(520, 530);

            this._propertyGrid = new PropertyGrid { Dock = DockStyle.Fill, PropertySort = PropertySort.CategorizedAlphabetical };
            this.Controls.Add(this._propertyGrid);

            this.ParentChanged += this.OnParentChanged;
        }

        private void OnParentChanged(object sender, EventArgs args)
        {
            if (this._currentParent != null)
            {
                this._currentParent.SizeChanged -= this.OnParentOnSizeChanged;
            }

            this._currentParent = this.Parent;
            this.SetSize();
            this.Parent.SizeChanged += this.OnParentOnSizeChanged;
        }

        private void OnParentOnSizeChanged(object o, EventArgs eventArgs)
        {
            this.SetSize();
        }

        private void SetSize()
        {
            this.Size = this.Parent.ClientSize;
            this.Controls[0].Size = this.ClientSize;
        }
<commit_msg>Sort out initial size of property grid config<commit_after>﻿namespace JDunkerley.AlteryxAddIns.Framework.ConfigWindows
{
    using System;
    using System.Drawing;
    using System.Windows.Forms;
    using System.Xml;

    using AlteryxGuiToolkit.Plugins;

    /// <summary>
    /// Simple Property Grid Based Configuration Panel
    /// </summary>
    /// <typeparam name="T">Configuration Object</typeparam>
    /// <seealso cref="System.Windows.Forms.UserControl" />
    /// <seealso cref="AlteryxGuiToolkit.Plugins.IPluginConfiguration" />
    public class PropertyGridGui<T> : UserControl, IPluginConfiguration
        where T: new()
    {
        /// <summary>
        /// The _property grid
        /// </summary>
        private readonly PropertyGrid _propertyGrid;

        /// <summary>
        /// The configuration
        /// </summary>
        private T _config;

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyGridGui{T}"/> class.
        /// </summary>
        public PropertyGridGui()
        {
            this.Margin = new Padding(4);
            this.Size = new System.Drawing.Size(400, 400);
            this.Name = nameof(PropertyGridGui<T>);
            this.AutoScaleMode = AutoScaleMode.Font;
            this.AutoScaleDimensions = new SizeF(6f, 13f);

            this._propertyGrid = new PropertyGrid
                                     {
                                         Anchor =
                                             AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left
                                             | AnchorStyles.Right,
                                         PropertySort = PropertySort.CategorizedAlphabetical,
                                         Size = this.ClientSize
                                     };
            this.Controls.Add(this._propertyGrid);
        }

{'fraction_non_alphanumeric': 0.10531569752932368, 'fraction_numerical': 0.004492138757174944, 'mean_word_length': 1.659588586595886, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4623691', 'n_tokens_mistral': 1022, 'n_tokens_neox': 996, 'n_words': 216}