private void PostCraftButton_Click(object sender, RoutedEventArgs e)
        {
            BigBox.Text = "";
            if (Bench.BenchItem == null)
            {
                BigBox.Text = "Bench is empty";
                return;
            }
            PoEBaseItemData itemtemplate = CraftingDatabase.AllBaseItems[Bench.BenchItem.SourceData];
            PostCraftDialog d            = new PostCraftDialog(ModLogic.FindValidBenchMods(itemtemplate, CraftingDatabase.BenchOptions, CraftingDatabase.AllMods), Bench.PostRoll)
            {
                Owner = this
            };
            bool?res = d.ShowDialog();

            if (!res.HasValue || !res.Value)
            {
                return;
            }
            PostRollOptions ops = d.GetPostRollOptions();

            if (!ops.Maximize && ops.TryCrafts.Count == 0)
            {
                PostCraftButton.ClearValue(Button.BackgroundProperty);
            }
            else
            {
                PostCraftButton.Background = Brushes.Green;
            }
            Bench.PostRoll = ops;
        }
        private void BenchMove_Click(object sender, EventArgs e)
        {
            ItemCraft item     = ((MenuItem)sender).Tag as ItemCraft;
            bool      samebase = item != null && Bench.BenchItem != null && item.SourceData == Bench.BenchItem.SourceData;

            Bench.BenchItem = item.Copy();
            ItemSlot.UpdateData(Bench.BenchItem);
            ModPreview.UpdatePreviews();
            if (!samebase)
            {
                ModPreview.UpdateCrafts();
                ModPreview.UpdateEnchantments();
                Bench.PostRoll = new PostRollOptions();
                PostCraftButton.ClearValue(Button.BackgroundProperty);
            }
        }
        private void ItemBaseButton_Click(object sender, RoutedEventArgs e)
        {
            BigBox.Text = "";
            if (CraftingDatabase.CoreBaseItems == null)
            {
                return;
            }

            BaseItemDialog d = new BaseItemDialog(CraftingDatabase.CoreBaseItems)
            {
                Owner = this
            };
            bool?res = d.ShowDialog();

            if (!res.HasValue || !res.Value || d.ItemNameView.SelectedItem == null)
            {
                return;
            }

            if (int.TryParse(d.ILvlBox.Text, out int ilvl))
            {
                ilvl = (ilvl < 1) ? 1 : (ilvl > 100) ? 100 : ilvl;
            }
            else
            {
                ilvl = 100;
            }
            ISet <ItemInfluence> infs = new HashSet <ItemInfluence>();

            if (d.ShaperCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Shaper);
            }
            if (d.ElderCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Elder);
            }
            if (d.RedeemerCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Redeemer);
            }
            if (d.HunterCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Hunter);
            }
            if (d.WarlordCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Warlord);
            }
            if (d.CrusaderCheck.IsChecked ?? false)
            {
                infs.Add(ItemInfluence.Crusader);
            }

            Bench.BenchItem = new ItemCraft(d.SelectedBase, ilvl, infs);
            ItemSlot.UpdateData(Bench.BenchItem);
            ModPreview.UpdatePreviews();
            ModPreview.UpdateCrafts();
            ModPreview.UpdateEnchantments();
            Bench.PostRoll = new PostRollOptions();
            PostCraftButton.ClearValue(Button.BackgroundProperty);
        }