private void CalculateCosts()
{
SellPriceCosts = 0;
CraftPriceCosts = 0;
SellPriceCosts = Quantity * SellPrice;
foreach (Recipe r in RecipeItems)
{
r.CalculateCosts();
if (r.Way == RecipeWay.Buy)
{
CraftPriceCosts += r.SellPriceCosts;
}
else
{
CraftPriceCosts += r.CraftPriceCosts;
}
}
if (CraftPriceCosts != 0 && CraftPriceCosts < SellPriceCosts)
{
//Way = RecipeWay.Craft;
BestWay = RecipeWay.Craft;
}
else
{
//Way = RecipeWay.Buy;
BestWay = RecipeWay.Buy;
}
if (!_preSelected || IsAutomated)
{
Way = BestWay;
}
//OnPropertyChanged("CraftPriceCosts");
//OnPropertyChanged("SellPriceCosts");
//OnPropertyChanged("CraftPriceCostsMoney");
//OnPropertyChanged("SellPriceCostsMoney");
OnPropertyChanged("BestWay");
OnPropertyChanged("IsCraftBestWay");
OnPropertyChanged("IsBuyBestWay");
OnPropertyChanged("ProfitMoney");
OnPropertyChanged("ListingFeeMoney");
OnPropertyChanged("SaleFeeMoney");
OnPropertyChanged("IsAutomated");
OnPropertyChanged("MarginMoney");
OnPropertyChanged("MarginPercent");
var shoppingList = CalculateShoppingList(new List<Recipe>());
ShoppingList = new ObservableCollection<Recipe>(shoppingList);
OnPropertyChanged("ShoppingList");
_preSelected = true;
}