<commit_before>﻿using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows;

namespace RxExamplesWPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {


        public MainWindow()
        {
            InitializeComponent();

            InitializeSubject();            
        }

        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - Click\r\n";
            LogBox.ScrollToEnd();
        }

        #region Subject

        private Subject<RoutedEventArgs> _subject;

        private void InitializeSubject()
        {
            _subject = new Subject<RoutedEventArgs>();

            _subject.Subscribe(Subject_Next);
        }

        private void Subject_Next(RoutedEventArgs e)
        {
            LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - Next Subject\r\n";
            LogBox.ScrollToEnd();
        }

        private void SubjectButton_Click(object sender, RoutedEventArgs e)
        {
            _subject.OnNext(e);
        }

        #endregion
<commit_msg>Refactor to common AddToLogBox function<commit_after>﻿using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows;

namespace RxExamplesWPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {


        public MainWindow()
        {
            InitializeComponent();

            InitializeSubject();            
        }

        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            AddToLogBox("Click");
        }

        #region Subject

        private Subject<RoutedEventArgs> _subject;

        private void InitializeSubject()
        {
            _subject = new Subject<RoutedEventArgs>();

            _subject
                .Select(e => "Subject Next")
                .Subscribe(AddToLogBox);
        }

        private void SubjectButton_Click(object sender, RoutedEventArgs e)
        {
            _subject.OnNext(e);
        }

        #endregion

        private void AddToLogBox(string source)
        {
            LogBox.Text += DateTime.Now.ToString("HH:mm:ss.fffffff") + " - " + source + "\r\n";
            LogBox.ScrollToEnd();
        }
{'fraction_non_alphanumeric': 0.09900579950289976, 'fraction_numerical': 0.0008285004142502071, 'mean_word_length': 1.8345070422535212, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, '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': '796261', 'n_tokens_mistral': 665, 'n_tokens_neox': 631, 'n_words': 131}