<commit_before>﻿using anime_downloader.Classes;
using System;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using anime_downloader.Classes.Web.MyAnimeList;

namespace anime_downloader.Views
{
    public partial class AnimeDetails
    {
        private Anime _currentlyEditedAnime;

        public AnimeDetails()
        {
            InitializeComponent();
            KeyDown += AnimeList.KeyEscapeBack;
            MouseDown += AnimeList.MouseEscapeBack;
            MainWindow.Window.Settings.Subgroups.ToList().ForEach(s => SubgroupComboBox.Items.Add(s));
        }

        public void Load(Anime anime)
        {
            DataContext = anime;
            SubmitButton.Content = "Edit";
            SubmitButton.Click += Edit;
            _currentlyEditedAnime = anime;
            SubgroupComboBox.Text = anime.PreferredSubgroup != null && anime.PreferredSubgroup.Equals("")
                ? "(None)"
                : anime.PreferredSubgroup;
        }

        public void New()
        {
            // Default template
            DataContext = new Anime
            {
                Episode = "00",
                Status = "Watching",
                Resolution = "720",
                Airing = true
            };

            SubmitButton.Click += Add;
            MainWindow.Window.Settings.Subgroups.ToList().ForEach(s => SubgroupComboBox.Items.Add(s));
            OpenLastButton.Visibility = Visibility.Hidden;
        }

        private void Add(object sender, RoutedEventArgs routedEventArgs)
        {
            if (NameTextbox.Empty())
                Methods.Alert("There needs to be a name.");
            else
            {<commit_msg>Fix subgroups doubling in new anime details view<commit_after>﻿using anime_downloader.Classes;
using System;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using anime_downloader.Classes.Web.MyAnimeList;

namespace anime_downloader.Views
{
    public partial class AnimeDetails
    {
        private Anime _currentlyEditedAnime;

        public AnimeDetails()
        {
            InitializeComponent();
            KeyDown += AnimeList.KeyEscapeBack;
            MouseDown += AnimeList.MouseEscapeBack;
            MainWindow.Window.Settings.Subgroups.ToList().ForEach(s => SubgroupComboBox.Items.Add(s));
        }

        public void Load(Anime anime)
        {
            DataContext = anime;
            SubmitButton.Content = "Edit";
            SubmitButton.Click += Edit;
            _currentlyEditedAnime = anime;
            SubgroupComboBox.Text = anime.PreferredSubgroup != null && anime.PreferredSubgroup.Equals("")
                ? "(None)"
                : anime.PreferredSubgroup;
        }

        public void New()
        {
            // Default template
            DataContext = new Anime
            {
                Episode = "00",
                Status = "Watching",
                Resolution = "720",
                Airing = true
            };

            SubmitButton.Click += Add;
            OpenLastButton.Visibility = Visibility.Hidden;
        }

        private void Add(object sender, RoutedEventArgs routedEventArgs)
        {
            if (NameTextbox.Empty())
                Methods.Alert("There needs to be a name.");
            else
            {
{'fraction_non_alphanumeric': 0.08891454965357967, 'fraction_numerical': 0.002886836027713626, 'mean_word_length': 1.8401639344262295, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '402264', 'n_tokens_mistral': 915, 'n_tokens_neox': 874, 'n_words': 187}