private void abilityChainsAddNewAbilityChainButton_Click(object sender, EventArgs e) { var newForm = new AddNewAbilityChainForm(null); if (newForm.ShowDialog() != DialogResult.OK) return; var abilityChain = new AbilityChain { Name = newForm.abilityChainNameTextBox.Text, Specialization = WoWSpec.DruidFeral, HotKey = newForm.HotKey, ModiferKey = newForm.ModifierKey, ChainedAbilities = newForm.ChainedAbilities }; AddAbilityChainToListView(abilityChain); }
private void editItemToolStripMenuItem_Click(object sender, EventArgs e) { if (abilityChainsListView.SelectedItems.Count <= 0) return; var lvItem = abilityChainsListView.SelectedItems[0]; var editForm = new AddNewAbilityChainForm(lvItem.Tag as AbilityChain); if (editForm.ShowDialog() != DialogResult.OK) return; var abilityChain = new AbilityChain { Name = editForm.abilityChainNameTextBox.Text, Specialization = WoWSpec.DruidFeral, HotKey = editForm.HotKey, ModiferKey = editForm.ModifierKey, ChainedAbilities = editForm.ChainedAbilities }; var abilitiesStr = abilityChain.ChainedAbilities.Aggregate(string.Empty, (current, ability) => current + (abilityChain.ChainedAbilities.Last() == ability ? ability.FriendlyName : ability.FriendlyName + "; ")); lvItem.Text = editForm.abilityChainNameTextBox.Text; lvItem.SubItems[1].Text = Properties.Resources.AbilityChainsControl_editItemToolStripMenuItem_Click_Feral; lvItem.SubItems[2].Text = string.Format("{0} + {1}", abilityChain.ModiferKey, abilityChain.HotKey); lvItem.SubItems[3].Text = abilitiesStr; lvItem.Tag = abilityChain; }