<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows.Input;
using MahApps.Metro;
using System.Windows.Media;
using System.Windows;
using Badger.Commands;

namespace Badger.ViewModels
{
    /// <summary>
    /// 
    /// </summary>
    [Export(typeof(IBadgerSettingsItemViewModel))]
    public class AppearanceSettingsViewModel : BadgerSettingsItemViewModel
    {
        private List<AccentColorData> _accentColors;

        /// <summary>
        /// Default Constructor
        /// </summary>
        [ImportingConstructor]        
        public AppearanceSettingsViewModel()
        {
            this.DisplayName = "Appearance";

            this._accentColors = ThemeManager.DefaultAccents
                                            .Select(a => new AccentColorData() { Name = a.Name, ColorBrush = a.Resources["AccentColorBrush"] as Brush })
                                            .ToList();
        }

        /// <summary>
        /// List of all accent colors supported by MahApps.Metro
        /// </summary>
        public List<AccentColorData> AccentColors
        {
            get { return _accentColors; }
            set
            {
                if (value != _accentColors)
                {
                    _accentColors = value;
                }
            }
        }

        public void SetThemeDark()
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            ThemeManager.ChangeTheme(Application.Current, theme.Item2, Theme.Dark);
        }

        public void SetThemeLight()
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            ThemeManager.ChangeTheme(Application.Current, theme.Item2, Theme.Light);
        }
    }

    public class AccentColorData
    {
        public string Name { get; set; }
        public Brush ColorBrush { get; set; }

        private ICommand changeAccentCommand;

        public ICommand ChangeAccentCommand
        {
            get { return this.changeAccentCommand ?? (changeAccentCommand = new SimpleCommand { CanExecuteDelegate = x => true, ExecuteDelegate = x => ChangeAccent(x) }); }
        }

        private void ChangeAccent(object sender)
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            var accent = ThemeManager.DefaultAccents.First(x => x.Name == this.Name);
            ThemeManager.ChangeTheme(Application.Current, accent, theme.Item1);
        }<commit_msg>Updated comments<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows.Input;
using MahApps.Metro;
using System.Windows.Media;
using System.Windows;
using Badger.Commands;
using Badger.Managers;

namespace Badger.ViewModels
{
    /// <summary>
    /// Setting Item to change the Theme and Accent Colors
    /// </summary>
    [Export(typeof(IBadgerSettingsItemViewModel))]
    public class AppearanceSettingsViewModel : BadgerSettingsItemViewModel
    {
        private List<AccentColorData> _accentColors;

        /// <summary>
        /// Default Constructor
        /// </summary>
        [ImportingConstructor]        
        public AppearanceSettingsViewModel()
        {
            this.DisplayName = "Appearance";

            this._accentColors = ThemeManager.DefaultAccents
                                            .Select(a => new AccentColorData() { Name = a.Name, ColorBrush = a.Resources["AccentColorBrush"] as Brush })
                                            .ToList();
        }

        /// <summary>
        /// List of all accent colors supported by MahApps.Metro
        /// </summary>
        public List<AccentColorData> AccentColors
        {
            get { return _accentColors; }
            set
            {
                if (value != _accentColors)
                {
                    _accentColors = value;
                }
            }
        }

        /// <summary>
        /// Change the theme to the Dark Theme
        /// </summary>
        public void SetThemeDark()
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            ThemeManager.ChangeTheme(Application.Current, theme.Item2, Theme.Dark);
        }

        /// <summary>
        /// Change the theme to the Light Theme
        /// </summary>
        public void SetThemeLight()
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            ThemeManager.ChangeTheme(Application.Current, theme.Item2, Theme.Light);
        }
    }

    /// <summary>
    /// Class for aggregating and changing the accent color
    /// </summary>
    public class AccentColorData
    {
        /// <summary>
        /// Name of the accent color
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// The color of the accent
        /// </summary>
        public Brush ColorBrush { get; set; }

        private ICommand changeAccentCommand;

        /// <summary>
        /// Command to trigger changing the accent color
        /// </summary>
        public ICommand ChangeAccentCommand
        {
            get { return this.changeAccentCommand ?? (changeAccentCommand = new SimpleCommand { CanExecuteDelegate = x => true, ExecuteDelegate = x => ChangeAccent(x) }); }
        }

        private void ChangeAccent(object sender)
        {
            var theme = ThemeManager.DetectTheme(Application.Current);
            var accent = ThemeManager.DefaultAccents.First(x => x.Name == this.Name);
            ThemeManager.ChangeTheme(Application.Current, accent, theme.Item1);
        }
{'fraction_non_alphanumeric': 0.09700476514635807, 'fraction_numerical': 0.0010211027910142954, 'mean_word_length': 1.8570734078755469, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3513584', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1463, 'n_words': 349}