private void bt_delete_Click(object sender, RoutedEventArgs e)
 {
     foreach (ItemGenerator item in dg_items.SelectedItems)
     {
         DatabaseContorller.DeleteRow(item);
     }
     GetData();
 }
        private void GetData()
        {
            ItemGenerators = DatabaseContorller.GetAllData();

            //DataGrid feltöltése
            dg_items.Items.Clear();
            foreach (ItemGenerator item in ItemGenerators)
            {
                dg_items.Items.Add(item);
            }

            //DataGrid formázása
            StaticHelper.DataGridFormat(dg_items, ItemGenerators, (bool)cb_enableBonuses.IsChecked);
        }
        private void bt_copyImages_Click(object sender, RoutedEventArgs e)
        {
            //Fájl törlés
            string thisFolder = debugFolder.Replace(" ItemCreator", "") + "Images\\";

            string[] fileArray = Directory.GetFiles(thisFolder, "*.png");
            foreach (string imagesPath in fileArray)
            {
                File.Delete(imagesPath);
            }



            foreach (ItemGenerator imagesPath in DatabaseContorller.GetAllData())
            {
                string from = imagesPath.item_image;

                string to = imagesPath.item_image.Replace(" ItemCreator", "").Replace("wowicons\\", "Images\\");
                File.Copy(from, to, true);
            }
        }
        private void bt_save_Click(object sender, RoutedEventArgs e)
        {
            ItemGenerator itemGenerator = new ItemGenerator();

            itemGenerator.item_name  = tb_itemName.Text.ToString();
            itemGenerator.item_image = tb_itemImage.Text.ToString();
            if (cb_itemType.SelectedItem != null)
            {
                itemGenerator.item_type = cb_itemType.SelectedIndex;
            }
            if (cb_itemRarity.SelectedItem != null)
            {
                itemGenerator.item_rarity = cb_itemRarity.SelectedIndex;
            }

            if (cb_itemPotionEffect.SelectedItem != null)
            {
                itemGenerator.item_potionEffect = cb_itemPotionEffect.SelectedIndex;
            }
            itemGenerator.item_potionEffectValue    = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_itemPotionEffectValue.Text));
            itemGenerator.item_potionEffectDuration = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_itemPotionEffectDuration.Text));

            itemGenerator.item_primaryStat_damageMax_randomMin  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_item_primaryStat_damageMax_randomMin.Text));
            itemGenerator.item_primaryStat_damageMax_randomMax  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_item_primaryStat_damageMax_randomMax.Text));
            itemGenerator.item_primaryStat_defenseMax_randomMin = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_item_primaryStat_defenseMax_randomMin.Text));
            itemGenerator.item_primaryStat_defenseMax_randomMax = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_item_primaryStat_defenseMax_randomMax.Text));


            itemGenerator.item_level            = Convert.ToInt32(tb_itemLevel.Text);
            itemGenerator.item_requiedHeroLevel = Convert.ToInt32(tb_itemRequiedLevel.Text);
            itemGenerator.item_quantityFrom     = Convert.ToInt32(tb_itemQuantityFrom.Text);
            itemGenerator.item_quantityTo       = Convert.ToInt32(tb_itemQuantityTo.Text);

            itemGenerator.item_isStackable = ((bool)cb_isStackable.IsChecked ? 1 : 0);

            if (cb_itemQualityFrom.SelectedItem != null && cb_itemQualityTo.SelectedItem != null)
            {
                itemGenerator.item_qualityFrom = cb_itemQualityFrom.SelectedIndex;
                itemGenerator.item_qualityTo   = cb_itemQualityTo.SelectedIndex;
            }



            itemGenerator.item_bonus1_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus1_min.Text));
            itemGenerator.item_bonus1_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus1_max.Text));
            itemGenerator.item_bonus2_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus2_min.Text));
            itemGenerator.item_bonus2_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus2_max.Text));
            itemGenerator.item_bonus3_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus3_min.Text));
            itemGenerator.item_bonus3_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus3_max.Text));
            itemGenerator.item_bonus4_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus4_min.Text));
            itemGenerator.item_bonus4_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus4_max.Text));
            itemGenerator.item_bonus5_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus5_min.Text));
            itemGenerator.item_bonus5_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus5_max.Text));
            itemGenerator.item_bonus6_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus6_min.Text));
            itemGenerator.item_bonus6_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus6_max.Text));
            itemGenerator.item_bonus7_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus7_min.Text));
            itemGenerator.item_bonus7_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus7_max.Text));
            itemGenerator.item_bonus8_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus8_min.Text));
            itemGenerator.item_bonus8_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus8_max.Text));
            itemGenerator.item_bonus9_min  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus9_min.Text));
            itemGenerator.item_bonus9_max  = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus9_max.Text));
            itemGenerator.item_bonus10_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus10_min.Text));
            itemGenerator.item_bonus10_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus10_max.Text));
            itemGenerator.item_bonus11_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus11_min.Text));
            itemGenerator.item_bonus11_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus11_max.Text));
            itemGenerator.item_bonus12_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus12_min.Text));
            itemGenerator.item_bonus12_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus12_max.Text));
            itemGenerator.item_bonus13_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus13_min.Text));
            itemGenerator.item_bonus13_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus13_max.Text));
            itemGenerator.item_bonus14_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus14_min.Text));
            itemGenerator.item_bonus14_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus14_max.Text));
            itemGenerator.item_bonus15_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus15_min.Text));
            itemGenerator.item_bonus15_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus15_max.Text));

            itemGenerator.item_bonus16_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus16_min.Text));
            itemGenerator.item_bonus16_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus16_max.Text));
            itemGenerator.item_bonus17_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus17_min.Text));
            itemGenerator.item_bonus17_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus17_max.Text));
            itemGenerator.item_bonus18_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus18_min.Text));
            itemGenerator.item_bonus18_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus18_max.Text));
            itemGenerator.item_bonus19_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus19_min.Text));
            itemGenerator.item_bonus19_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus19_max.Text));
            itemGenerator.item_bonus20_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus20_min.Text));
            itemGenerator.item_bonus20_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus20_max.Text));
            itemGenerator.item_bonus21_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus21_min.Text));
            itemGenerator.item_bonus21_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus21_max.Text));
            itemGenerator.item_bonus22_min = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus22_min.Text));
            itemGenerator.item_bonus22_max = Convert.ToInt32(StaticHelper.ifStringEmpty(tb_bonus22_max.Text));

            DatabaseContorller.InsertNewRow(itemGenerator);

            bt_new_Click(null, null);



            //bemásolja azt a képet amelyik ki lett választva
            string from = debugFolder + "wowicons\\" + itemGenerator.item_image;

            string to = from.Replace(" ItemCreator", "").Replace("wowicons\\", "Images\\");

            File.Copy(from, to, true);

            GetData();
        }