Ejemplo n.º 1
0
        /// <summary>
        /// Launchs a creation window depending on the category selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            textureSelected = null;

            try
            {
                ListBoxItem selectedItem = (ListBoxItem)MainList.SelectedItem;

                string selected = selectedItem.Content.ToString();

                ResetInfoLabel();
                GeneralInfoTextBox.Text = "";

                ChildList.SelectedIndex = -1;

                switch (selected)
                {
                    case "Abilities":

                        AbilityWindow abilityWindow = new AbilityWindow(manager, false, null);
                        abilityWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Character":

                        CharacterWindow characterWindow = new CharacterWindow(manager, false);
                        characterWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Consumables":

                        ConsumableWindow consumableWindow = new ConsumableWindow(manager, false, null);
                        consumableWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Doors & Keys":

                        DoorKeyWindow doorKeyWindow = new DoorKeyWindow(manager, false, null, null);
                        doorKeyWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Enemies":

                        EnemyWindow enemyWindow = new EnemyWindow(manager, false, null);
                        enemyWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "NPCs":

                        NPCWindow npcWindow = new NPCWindow(manager, false, null);
                        npcWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Walls":

                        WallWindow wallWindoe = new WallWindow(manager, false, null);
                        wallWindoe.ShowDialog();
                        RefreshList();

                        break;
                    case "Weapons":

                        WeaponWindow weaponWindow = new WeaponWindow(manager, false, null);
                        weaponWindow.ShowDialog();
                        RefreshList();

                        break;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No category selected.", "Attention", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Launch a creation window, with the "edit" option, depending on the category selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            textureSelected = null;

            try
            {
                if (ChildList.SelectedItem == null)
                {
                    throw new NullReferenceException();
                }

                String selectedElement = (String)ChildList.SelectedItem;
                ListBoxItem selectedItem = (ListBoxItem)MainList.SelectedItem;

                string selected = selectedItem.Content.ToString();

                ResetInfoLabel();
                GeneralInfoTextBox.Text = "";

                switch (selected)
                {
                    case "Abilities":

                        AbilityWindow abilityWindow = new AbilityWindow(manager, true, manager.GetAbility(selectedElement));
                        abilityWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Character":

                        CharacterWindow characterWindow = new CharacterWindow(manager, true);
                        characterWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Consumables":

                        ConsumableWindow consumableWindow = new ConsumableWindow(manager, true, manager.GetConsumable(selectedElement));
                        consumableWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Doors & Keys":

                        DoorKeyWindow doorKeyWindow = new DoorKeyWindow(manager, true, manager.GetDoor(selectedElement + "_Door"), manager.GetKey(selectedElement + "_Key"));
                        doorKeyWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Enemies":

                        EnemyWindow enemyWindow = new EnemyWindow(manager, true, manager.GetEnemy(selectedElement));
                        enemyWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "NPCs":

                        NPCWindow npcWindow = new NPCWindow(manager, true, manager.GetNPC(selectedElement));
                        npcWindow.ShowDialog();
                        RefreshList();

                        break;
                    case "Walls":

                        WallWindow wallWindoe = new WallWindow(manager, true, manager.GetBgItem(selectedElement));
                        wallWindoe.ShowDialog();
                        RefreshList();

                        break;
                    case "Weapons":

                        WeaponWindow weaponWindow = new WeaponWindow(manager, true, manager.GetWeapon(selectedElement));
                        weaponWindow.ShowDialog();
                        RefreshList();

                        break;
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("No element selected.", "Attention", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception)
            {
                MessageBox.Show("No category selected.", "Attention", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }