<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Threading;

namespace ExcelWvvm
{
    public class WindowHelper
    {
        public delegate Window CreateWindowHandler(params object[] args);
        public delegate void SetWindowHandler(Window win, params object[] args);
        public static void ShowWindow(CreateWindowHandler createHandler, params object[] args)
        {
            ThreadStart ts = delegate { dispatchWindow(createHandler, args); };
            startThread(ts);
        }

        public static void ShowWindow<T>(SetWindowHandler setWindowHandler, params object[] args) where T : Window, new()
        {
            ThreadStart ts = delegate { dispatchWindow<T>(setWindowHandler, args); };
            startThread(ts);
        }
            Thread thread = new Thread(ts);
            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }

        private static void dispatchWindow(CreateWindowHandler createHandler, params object[] args)
        {
            if (createHandler != null)
            {
                Window win = createHandler(args);
                win.Show();
                win.Closed += (sender, e) => win.Dispatcher.InvokeShutdown();
                Dispatcher.Run();
            }<commit_msg>Fixed build issue<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Threading;

namespace ExcelWvvm
{
    public class WindowHelper
    {
        public delegate Window CreateWindowHandler(params object[] args);
        public delegate void SetWindowHandler(Window win, params object[] args);
        public static void ShowWindow(CreateWindowHandler createHandler, params object[] args)
        {
            ThreadStart ts = delegate { dispatchWindow(createHandler, args); };
            startThread(ts);
        }

        public static void ShowWindow<T>(SetWindowHandler setWindowHandler, params object[] args) where T : Window, new()
        {
            ThreadStart ts = delegate { dispatchWindow<T>(setWindowHandler, args); };
            startThread(ts);
        }

        private static void startThread(ThreadStart ts)
        { 
            Thread thread = new Thread(ts);
            thread.SetApartmentState(ApartmentState.STA);
            thread.IsBackground = true;
            thread.Start();
        }

        private static void dispatchWindow(CreateWindowHandler createHandler, params object[] args)
        {
            if (createHandler != null)
            {
                Window win = createHandler(args);
                win.Show();
                win.Closed += (sender, e) => win.Dispatcher.InvokeShutdown();
                Dispatcher.Run();
            }
{'fraction_non_alphanumeric': 0.08960692871419054, 'fraction_numerical': 0.0, 'mean_word_length': 2.377952755905512, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1970939', 'n_tokens_mistral': 734, 'n_tokens_neox': 708, 'n_words': 197}