private void RemoveArtifactSet_Click(object sender, RoutedEventArgs e)
    {
        if (User.Instance.CurrentHero.ArtifactSets.Count > 1)
        {
            var result = AlertBox.Show("Are you sure you want to delete selected artifact set?");

            if (result == MessageBoxResult.No)
            {
                return;
            }

            if (!EquipmentHelper.CanArtifactSetsBeChanged())
            {
                AlertBox.Show("Artifact Sets cannot be changed while in combat or questing", MessageBoxButton.OK);
                return;
            }

            var removedSetId = User.Instance.CurrentHero.CurrentArtifactSetId;

            var firstId   = User.Instance.CurrentHero.ArtifactSets.Min(x => x.Id);
            var firstName = User.Instance.CurrentHero.ArtifactSets.FirstOrDefault(x => x.Id == firstId)?.Name;

            var oldGrid = LogicalTreeHelper.FindLogicalNode(ArtifactsPanel, "ArtifactSetsGrid") as Grid;
            var artifactSetsComboBox = LogicalTreeHelper.FindLogicalNode(oldGrid, "ArtifactSetsComboBox") as ComboBox;
            artifactSetsComboBox.SelectedItem = firstName;

            User.Instance.CurrentHero.ArtifactSets.RemoveAt(removedSetId);

            RefreshWholeArtifactsPanel();
        }
        else
        {
            AlertBox.Show("You cannot delete the only Artifact Set - you must always have at least one.", MessageBoxButton.OK);
        }
    }
    private void ArtifactSetsComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (_artifactSetsComboBoxSelectionHandled)
        {
            if (!EquipmentHelper.CanArtifactSetsBeChanged())
            {
                AlertBox.Show("Artifact Sets cannot be changed while in combat or questing", MessageBoxButton.OK);

                var comboBox = sender as ComboBox;
                _artifactSetsComboBoxSelectionHandled = false;
                comboBox.SelectedItem = e.RemovedItems[0];

                return;
            }

            var artifactSetName = e.AddedItems[0]?.ToString();

            var artifactSetId = User.Instance.CurrentHero.ArtifactSets.FirstOrDefault(x => x.Name == artifactSetName).Id;

            EquipmentHelper.SwitchArtifactSet(artifactSetId);

            // Refresh the entire panel.
            RefreshWholeArtifactsPanel();
            ArtifactsScrollViewer.ScrollToTop();
        }

        _artifactSetsComboBoxSelectionHandled = true;
    }
    private void AddArtifactSet_Click(object sender, RoutedEventArgs e)
    {
        if (!EquipmentHelper.CanArtifactSetsBeChanged())
        {
            AlertBox.Show("Artifact Sets cannot be changed while in combat or questing", MessageBoxButton.OK);
            return;
        }

        var newId = User.Instance.CurrentHero.ArtifactSets.Max(x => x.Id) + 1;

        User.Instance.CurrentHero.ArtifactSets.Add(new ArtifactSet
        {
            Id   = newId,
            Name = "Artifact Set " + newId
        });

        RefreshWholeArtifactsPanel();

        var oldGrid = LogicalTreeHelper.FindLogicalNode(ArtifactsPanel, "ArtifactSetsGrid") as Grid;
        var artifactSetsComboBox = LogicalTreeHelper.FindLogicalNode(oldGrid, "ArtifactSetsComboBox") as ComboBox;

        artifactSetsComboBox.SelectedItem = "Artifact Set " + newId;
    }