<commit_before>﻿// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;

namespace Core2D.Wpf.Controls.Custom.Lists
{
    /// <summary>
    /// The <see cref="ListBox"/> control for <see cref="ShapeStyle"/> items with drag and drop support.
    /// </summary>
    public class ShapeStyleDragAndDropListBox : DragAndDropListBox<ShapeStyle>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ShapeStyleDragAndDropListBox"/> class.
        /// </summary>
        public ShapeStyleDragAndDropListBox()
            : base()
        {
            this.Initialized += (s, e) => base.Initialize();
        }

        /// <summary>
        /// Updates DataContext binding to ImmutableArray collection property.
        /// </summary>
        /// <param name="array">The updated immutable array.</param>
        public override void UpdateDataContext(ImmutableArray<ShapeStyle> array)
        {
            var editor = (Core2D.Editor)this.Tag;

            var sg = editor.Project.CurrentStyleLibrary;

            var previous = sg.Items;
            var next = array;
            editor.Project.History.Snapshot(previous, next, (p) => sg.Items = p);
            sg.Items = next;
        }
    }
}<commit_msg>Update ShapeStyleDragAndDropListBox.cs<commit_after>﻿// Copyright (c) <NAME>. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Immutable;
using System.Windows.Controls;

namespace Core2D.Wpf.Controls.Custom.Lists
{
    /// <summary>
    /// The <see cref="ListBox"/> control for <see cref="ShapeStyle"/> items with drag and drop support.
    /// </summary>
    public class ShapeStyleDragAndDropListBox : DragAndDropListBox<ShapeStyle>
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ShapeStyleDragAndDropListBox"/> class.
        /// </summary>
        public ShapeStyleDragAndDropListBox()
            : base()
        {
            this.Initialized += (s, e) => base.Initialize();
        }

        /// <summary>
        /// Updates DataContext binding to ImmutableArray collection property.
        /// </summary>
        /// <param name="array">The updated immutable array.</param>
        public override void UpdateDataContext(ImmutableArray<ShapeStyle> array)
        {
            var editor = (Core2D.Editor)this.Tag;

            var sg = editor.Project.CurrentStyleLibrary;

            var previous = sg.Items;
            var next = array;
            editor.project?.History?.Snapshot(previous, next, (p) => sg.Items = p);
            sg.Items = next;
        }
    }
}
{'fraction_non_alphanumeric': 0.11829484902309059, 'fraction_numerical': 0.0014209591474245115, 'mean_word_length': 2.2630359212050983, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, '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': '5628256', 'n_tokens_mistral': 755, 'n_tokens_neox': 736, 'n_words': 209}