<commit_before>﻿// -----------------------------------------------------------------------
// <copyright file="IFocusManager.cs" company="<NAME>">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

using Perspex.Controls;

namespace Perspex.Input
{
    public class FocusManager : IFocusManager
    {
        public IFocusable Current
        {
            get;
            private set;
        }

        public void Focus(IFocusable control)
        {
            Interactive current = this.Current as Interactive;
            Interactive next = control as Interactive;

            if (current != null)
            {
                current.RaiseEvent(new RoutedEventArgs
                {
                    RoutedEvent = Control.GotFocusEvent,
                    Source = current,
                    OriginalSource = current,
                });
            }

            this.Current = control;

            if (next != null)
            {
                next.RaiseEvent(new RoutedEventArgs
                {
                    RoutedEvent = Control.GotFocusEvent,
                    Source = next,
                    OriginalSource = next,
                });
            }
        }
    }
}
<commit_msg>Correctly send lost focus event.<commit_after>﻿// -----------------------------------------------------------------------
// <copyright file="IFocusManager.cs" company="<NAME>">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------

using Perspex.Controls;

namespace Perspex.Input
{
    public class FocusManager : IFocusManager
    {
        public IFocusable Current
        {
            get;
            private set;
        }

        public void Focus(IFocusable control)
        {
            Interactive current = this.Current as Interactive;
            Interactive next = control as Interactive;

            if (current != null)
            {
                current.RaiseEvent(new RoutedEventArgs
                {
                    RoutedEvent = Control.LostFocusEvent,
                    Source = current,
                    OriginalSource = current,
                });
            }

            this.Current = control;

            if (next != null)
            {
                next.RaiseEvent(new RoutedEventArgs
                {
                    RoutedEvent = Control.GotFocusEvent,
                    Source = next,
                    OriginalSource = next,
                });
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.17600896860986548, 'fraction_numerical': 0.0029895366218236174, 'mean_word_length': 0.9626099706744868, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '4526996', 'n_tokens_mistral': 613, 'n_tokens_neox': 549, 'n_words': 136}