<commit_before>using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;

namespace ControlCatalog.Pages;

public class PointersPage : UserControl
{
    public PointersPage()
    {
        this.InitializeComponent();

        var border1 = this.Get<Border>("BorderCapture1");
        var border2 = this.Get<Border>("BorderCapture2");

        border1.PointerPressed += Border_PointerPressed;
        border1.PointerReleased += Border_PointerReleased;
        border1.PointerCaptureLost += Border_PointerCaptureLost;
        border1.PointerMoved += Border_PointerUpdated;
        border1.PointerEnter += Border_PointerUpdated;
        border1.PointerLeave += Border_PointerUpdated;

        border2.PointerPressed += Border_PointerPressed;
        border2.PointerReleased += Border_PointerReleased;
        border2.PointerCaptureLost += Border_PointerCaptureLost;
        border2.PointerMoved += Border_PointerUpdated;
        border2.PointerEnter += Border_PointerUpdated;
        border2.PointerLeave += Border_PointerUpdated;
    }

    private void Border_PointerUpdated(object sender, PointerEventArgs e)
    {
        var textBlock = (TextBlock)((Border)sender).Child;
        var position = e.GetPosition((Border)sender);
        textBlock.Text = @$"Captured: {e.Pointer.Captured == sender}
PointerId: {e.Pointer.Id}
Position: {(int)position.X} {(int)position.Y}";
        e.Handled = true;
    }

    private void Border_PointerCaptureLost(object sender, PointerCaptureLostEventArgs e)
    {
        var textBlock = (TextBlock)((Border)sender).Child;
        textBlock.Text = @$"Captured: {e.Pointer.Captured == sender}
PointerId: {e.Pointer.Id}
Position: ??? ???";
        e.Handled = true;
    }

    private void Border_PointerReleased(object sender, PointerReleasedEventArgs e)
    {
        if (e.Pointer.Captured == sender)
        {
            e.Pointer.Capture(null);
            e.Handled = true;
        }
        else
        {
            throw new InvalidOperationException("How?");
        }
    }

    private void Border_PointerPressed(object sender, PointerPressedEventArgs e)
    {
        e.Pointer.Capture((Border)sender);
        e.Handled = true;
    }

    private void InitializeComponent()
    {
        AvaloniaXamlLoader.Load(this);
    }
}
<commit_msg>Fix after event were renamed<commit_after>using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;

namespace ControlCatalog.Pages;

public class PointersPage : UserControl
{
    public PointersPage()
    {
        this.InitializeComponent();

        var border1 = this.Get<Border>("BorderCapture1");
        var border2 = this.Get<Border>("BorderCapture2");

        border1.PointerPressed += Border_PointerPressed;
        border1.PointerReleased += Border_PointerReleased;
        border1.PointerCaptureLost += Border_PointerCaptureLost;
        border1.PointerMoved += Border_PointerUpdated;
        border1.PointerEntered += Border_PointerUpdated;
        border1.PointerExited += Border_PointerUpdated;

        border2.PointerPressed += Border_PointerPressed;
        border2.PointerReleased += Border_PointerReleased;
        border2.PointerCaptureLost += Border_PointerCaptureLost;
        border2.PointerMoved += Border_PointerUpdated;
        border2.PointerEntered += Border_PointerUpdated;
        border2.PointerExited += Border_PointerUpdated;
    }

    private void Border_PointerUpdated(object sender, PointerEventArgs e)
    {
        var textBlock = (TextBlock)((Border)sender).Child;
        var position = e.GetPosition((Border)sender);
        textBlock.Text = @$"Captured: {e.Pointer.Captured == sender}
PointerId: {e.Pointer.Id}
Position: {(int)position.X} {(int)position.Y}";
        e.Handled = true;
    }

    private void Border_PointerCaptureLost(object sender, PointerCaptureLostEventArgs e)
    {
        var textBlock = (TextBlock)((Border)sender).Child;
        textBlock.Text = @$"Captured: {e.Pointer.Captured == sender}
PointerId: {e.Pointer.Id}
Position: ??? ???";
        e.Handled = true;
    }

    private void Border_PointerReleased(object sender, PointerReleasedEventArgs e)
    {
        if (e.Pointer.Captured == sender)
        {
            e.Pointer.Capture(null);
            e.Handled = true;
        }
        else
        {
            throw new InvalidOperationException("How?");
        }
    }

    private void Border_PointerPressed(object sender, PointerPressedEventArgs e)
    {
        e.Pointer.Capture((Border)sender);
        e.Handled = true;
    }

    private void InitializeComponent()
    {
        AvaloniaXamlLoader.Load(this);
    }
}

{'fraction_non_alphanumeric': 0.10187328983371921, 'fraction_numerical': 0.006735424121237634, 'mean_word_length': 3.0719794344473006, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1209757', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1338, 'n_words': 246}