Example #1
0
        private Ability ShowAbility(Ability input)
        {
            Ability output = null;

            RepoPC.UpdateAvailableAbilities();
            int before = RepoPC.AbilitiesList.Count;

            ShowAbility showAbility = new ShowAbility();

            showAbility.Initialize(input);
            showAbility.ShowDialog();

            RepoPC.UpdateAvailableAbilities();
            int after = RepoPC.AbilitiesList.Count;

            try
            {
                if (after != before - 1)
                {
                    output = RepoPC.AbilitiesList.Find(x => x.ID == input.ID);
                }
            }
            catch (ArgumentNullException)
            {
            }

            return(output);
        }
        private void ShowAbility_Click(object sender, RoutedEventArgs e)
        {
            int before      = RepoPC.AbilitiesList.Count;
            int indexBefore = AbilitySelction.SelectedIndex;

            ShowAbility showAbility = new ShowAbility();

            showAbility.Initialize(RepoPC.AbilitiesList[indexBefore]);
            showAbility.ShowDialog();

            RepoPC.UpdateAvailableAbilities();
            int after = RepoPC.AbilitiesList.Count;

            if (after == before - 1)
            {
                AbilitySelction.ItemsSource   = new string[] { "You Can't See Me" };
                AbilitySelction.ItemsSource   = RepoPC.AbilityNamesList;
                AbilitySelction.SelectedIndex = indexBefore - 1;
            }
            UpdateView();
        }