private void ListViewActions_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (ListViewActions.SelectedIndex >= 0)
     {
         CurrentActions?.Clear();
         Sim.RemoveActionAt(ListViewActions.SelectedIndex);
     }
 }
        private void Sim_FinishedExecution(CraftingSim sim)
        {
            Dispatcher.Invoke(() =>
            {
                if (ListViewActions.ItemsSource != null)
                {
                    var list = (ListViewActions.ItemsSource as List <CraftingActionContainer>);
                    for (int i = 0; i < list.Count; i++)
                    {
                        list[i].Dispose();
                    }
                }
                if (Sim.CraftingActionsLength > 0)
                {
                    for (int i = 0; i < CurrentActions.Count; i++)
                    {
                        CurrentActions[i].Update();
                    }
                }
                else
                {
                    CurrentActions.Clear();
                }


                ListViewActions.ItemsSource = CurrentActions.ToList();

                if (ListViewCraftingBuffs.ItemsSource != null)
                {
                    var list = (ListViewCraftingBuffs.ItemsSource as List <CraftingBuffContainer>);
                    for (int i = 0; i < list.Count; i++)
                    {
                        list[i].Source = null;
                    }
                }
                ListViewCraftingBuffs.ItemsSource = sim.CraftingBuffs.Select(x => new CraftingBuffContainer(G.Actions[x.Name].Images[sim.CurrentRecipe.ClassJob], x)).ToList();

                if (AvailableActions != null)
                {
                    for (int i = 0; i < AvailableActions.Length; i++)
                    {
                        AvailableActions[i].Update();
                    }
                }

                LabelScore.Content = "Score: " + Sim.Score.ToString("#.###");
            });
        }
        private void Sim_FinishedStep(CraftingSim sim, int index)
        {
            if (index == 0)
            {
                if (CurrentActions != null)
                {
                    CurrentActions.ForEach(x => x.Dispose());
                    CurrentActions.Clear();
                }
                CurrentActions = new List <CraftingActionContainer>();
                OldProgress    = 0;
                OldQuality     = 0;
            }
            var currentAction = sim.CraftingActions[index];
            CraftingActionContainer container = new CraftingActionContainer(Sim, currentAction);

            container.ProgressIncreased = sim.CurrentProgress - OldProgress;
            container.QualityIncreased  = sim.CurrentQuality - OldQuality;
            OldProgress = sim.CurrentProgress;
            OldQuality  = sim.CurrentQuality;
            CurrentActions.Add(container);
        }