// mb its not optimal, but its a working way of sorting :)
        private void SortHeroCards()
        {
            var children_array = new UIElement[wp_heroes.Children.Count];

            wp_heroes.Children.CopyTo(children_array, 0);
            wp_heroes.Children.Clear();
            List <UIElement> prevChildren = children_array.ToList();
            List <HeroCard>  note_used    = new List <HeroCard>();

            List <string> ids = HeroesData.GetHeroIDsSortedByLocalizedNames();

            foreach (string n in ids)
            {
                bool     isfound   = false;
                HeroCard prev_card = null;
                foreach (HeroCard u in prevChildren)
                {
                    if (u.HeroData.HeroID == n)
                    {
                        prev_card = u;
                        wp_heroes.Children.Add(u);
                        isfound = true;
                    }
                }

                if (isfound)
                {
                    prevChildren.Remove(prev_card);
                }
            }

            prevChildren.ForEach((e) => wp_heroes.Children.Add(e));
        }
        public MainWindow()
        {
            InitializeComponent();

            HeroesData.Load();
            SaveData.Load();
            //SaveData.Save();

            if (HeroesData.Heroes.Count != 0)
            {
                LoadHeroesList();
            }
            else
            {
                MessageBox.Show(LocalizationUtils.GetString("mainform_heroes_json_error", "Heroes.json not found or corrupted.\nTry to reinstall this program."),
                                LocalizationUtils.GetString("error", "Error")
                                );
            }

            UpdateProfilesList();
            SortHeroCards();
            UpdateLocale();

            SettingsData.Settings.OnLocaleChanged += Settings_OnLocaleChanged;

            if (SettingsData.Settings.MainWindowTop != null)
            {
                Top = (int)SettingsData.Settings.MainWindowTop;
            }
            if (SettingsData.Settings.MainWindowTop != null)
            {
                Left = (int)SettingsData.Settings.MainWindowLeft;
            }
            if (SettingsData.Settings.MainWindowWidth != null)
            {
                Width = (int)SettingsData.Settings.MainWindowWidth;
            }
            if (SettingsData.Settings.MainWindowHeight != null)
            {
                Height = (int)SettingsData.Settings.MainWindowHeight;
            }

            WindowState = SettingsData.Settings.MainWindowMaximized ? WindowState.Maximized : WindowState.Normal;
        }