コード例 #1
0
        public void ViewItem_OnExecute(object sender, ExecutedRoutedEventArgs e)
        {
            Item item   = (Item)e.Parameter;
            var  window = new ItemViewWindow(item);

            window.ShowDialog();

            if (window.Result != null)
            {
                PlannedRecipes.Add(window.Result);
            }
        }
コード例 #2
0
        public void ReleaseItem_OnExecute(object sender, ExecutedRoutedEventArgs e)
        {
            var           planned          = (Tuple <Item, List <Pickup> >)e.Parameter;
            List <Pickup> condensed_recipe = new List <Pickup>();

            //This recipe is discretized, so condense it to reduce crafting recalculation
            foreach (Pickup pickup in planned.Item2)
            {
                Pickup existing = condensed_recipe.FirstOrDefault(p => p.Id == pickup.Id);

                if (existing == null)
                {
                    condensed_recipe.Add(new Pickup(pickup.Id, pickup.Amount));
                }
                else
                {
                    existing.Amount += pickup.Amount;
                }
            }

            ItemManager.AddPickups(condensed_recipe);
            PlannedRecipes.Remove(planned);
        }
コード例 #3
0
 public void ClearPlan_OnExecute(object sender, ExecutedRoutedEventArgs e)
 {
     PlannedRecipes.Clear();
 }