/// <summary> /// Function that reopens a minionwindow after it was closed. /// </summary> /// <param name="source"></param> /// <param name="e"></param> private void Inspect_Click(object source, RoutedEventArgs e) { Minion select = minions.Mylist[lstMinions.SelectedIndex]; MinionWindow win = new MinionWindow(select); win.Show(); }
private void RecriutMinion_Click(object sender, RoutedEventArgs e) { string name = ReadName();//calls the read name function int strength = ReadStrenght(); if (!string.IsNullOrEmpty(name) && strength > 0) { Minion added = new Minion(name, strength, ReadType()); minions.AddItem(added); MinionWindow minWind = new MinionWindow(added); minWind.Show(); lstMinions.ItemsSource = minions.MyMinions(minions.Mylist); btnFireMinion.IsEnabled = true; btn_Save.IsEnabled = true; btn_Search.IsEnabled = true; btnInspect.IsEnabled = false; txtMinionName.Text = string.Empty; txtStrength.Text = string.Empty; } else { MessageBox.Show("Input faulty, the minion must have a strenght value and a name which are unique", "Faulty input", MessageBoxButton.OK); } }