<commit_before>﻿#region

using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using SteamAccountSwitcher;
using SteamAccountSwitcher.Properties;

#endregion

namespace SteamAccountswitcher
{
    public class AccountHandler
    {
        public readonly Action _hideWindow;
        public readonly Action _showWindow;
        private readonly StackPanel _stackPanel;
        private int SelectedIndex = -1;

        public AccountHandler(StackPanel stackPanel, Action hideWindow, Action showWindow)
        {
            _stackPanel = stackPanel;
            _hideWindow = hideWindow;
            _showWindow = showWindow;
            Refresh();
        }

        public void Add(Account account)
        {
            App.Accounts.Add(account);
            Refresh();
        }

        public void Refresh()
        {
            // Remove all buttons.
            _stackPanel.Children.Clear();

            // Add new buttons with saved shortcut data
            foreach (var btn in App.Accounts.Select(account => new Button
            {
                Content =
                    new TextBlock
                    {
                        Text = GetAccountDisplayName(account),
                        TextWrapping = TextWrapping.Wrap
                    },
                Height = Settings.Default.ButtonHeight,
                HorizontalContentAlignment = Settings.Default.ButtonTextAlignment,
                Padding = new Thickness(4, 0, 4, 0),
                ContextMenu = new MenuHelper(this).AccountMenu(),
                Background = new SolidColorBrush(account.Color),
                Foreground = new SolidColorBrush(Settings.Default.ButtonTextColor)
            }))
            {
                btn.Click += Button_Click;

                _stackPanel.Children.Add(btn);
            }
        }

        private void SetFocus(object sender)
        {
            SelectedIndex = _stackPanel.Children.IndexOf((Button) sender);
        }

        public void SetFocus(object sender, RoutedEventArgs e)
        {
            SetFocus(((ContextMenu) sender).PlacementTarget);
        }<commit_msg>Fix button vertical padding<commit_after>﻿#region

using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using SteamAccountSwitcher;
using SteamAccountSwitcher.Properties;

#endregion

namespace SteamAccountswitcher
{
    public class AccountHandler
    {
        public readonly Action _hideWindow;
        public readonly Action _showWindow;
        private readonly StackPanel _stackPanel;
        private int SelectedIndex = -1;

        public AccountHandler(StackPanel stackPanel, Action hideWindow, Action showWindow)
        {
            _stackPanel = stackPanel;
            _hideWindow = hideWindow;
            _showWindow = showWindow;
            Refresh();
        }

        public void Add(Account account)
        {
            App.Accounts.Add(account);
            Refresh();
        }

        public void Refresh()
        {
            // Remove all buttons.
            _stackPanel.Children.Clear();

            // Add new buttons with saved shortcut data
            foreach (var btn in App.Accounts.Select(account => new Button
            {
                Content =
                    new TextBlock
                    {
                        Text = GetAccountDisplayName(account),
                        TextWrapping = TextWrapping.Wrap
                    },
                Height = Settings.Default.ButtonHeight,
                HorizontalContentAlignment = Settings.Default.ButtonTextAlignment,
                Padding = new Thickness(4),
                ContextMenu = new MenuHelper(this).AccountMenu(),
                Background = new SolidColorBrush(account.Color),
                Foreground = new SolidColorBrush(Settings.Default.ButtonTextColor)
            }))
            {
                btn.Click += Button_Click;

                _stackPanel.Children.Add(btn);
            }
        }

        private void SetFocus(object sender)
        {
            SelectedIndex = _stackPanel.Children.IndexOf((Button) sender);
        }

        public void SetFocus(object sender, RoutedEventArgs e)
        {
            SetFocus(((ContextMenu) sender).PlacementTarget);
        }
{'fraction_non_alphanumeric': 0.07131537242472266, 'fraction_numerical': 0.001584786053882726, 'mean_word_length': 1.7322201607915895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '915768', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1004, 'n_words': 248}