private void AddClicked(object sender, RoutedEventArgs e)
        {
            EditWeaponWindow editWeapon = new EditWeaponWindow();

            editWeapon.Title = "Add Weapon";
            editWeapon.addSaveButton.Content = "Add";
            if (editWeapon.ShowDialog() == true)
            {
                mWeaponCollection.Add(editWeapon.TempWeapon);
                if (lbWeapons.ItemsSource == null)
                {
                    lbWeapons.ItemsSource = mWeaponCollection;
                }
                lbWeapons.Items.Refresh();
            }
        }
Example #2
0
        private void AddPressed(object sender, RoutedEventArgs e)
        {
            EditWeaponWindow editweapon = new EditWeaponWindow();

            editweapon.bSave.Visibility = Visibility.Hidden;
            editweapon.Title            = "Add Weapon";
            if (editweapon.ShowDialog() == true)
            {
                weaponcollection.Add(editweapon.MyWeapon);
                if (lbWeapons.ItemsSource == null)
                {
                    lbWeapons.ItemsSource = weaponcollection;
                }
                lbWeapons.Items.Refresh();
            }
        }
Example #3
0
        private void EditPressed(object sender, RoutedEventArgs e)
        {
            if (lbWeapons.SelectedIndex == -1)
            {
                return;
            }

            EditWeaponWindow editWeaponWindow = new EditWeaponWindow();

            editWeaponWindow.MyWeapon = lbWeapons.SelectedItem as Weapon;

            if (editWeaponWindow.ShowDialog() == true)
            {
                weaponcollection[lbWeapons.SelectedIndex] = editWeaponWindow.MyWeapon;
                lbWeapons.Items.Refresh();
            }
        }
        private void EditClicked(object sender, RoutedEventArgs e)
        {
            if (lbWeapons.SelectedIndex == -1)
            {
                return;
            }

            EditWeaponWindow editWeaponWindow = new EditWeaponWindow();

            editWeaponWindow.Title = "Edit Weapon";
            editWeaponWindow.addSaveButton.Content = "Save";
            editWeaponWindow.TempWeapon            = lbWeapons.SelectedItem as Weapon;

            if (editWeaponWindow.ShowDialog() == true)
            {
                mWeaponCollection[lbWeapons.SelectedIndex] = editWeaponWindow.TempWeapon;
                lbWeapons.Items.Refresh();
            }
        }