Cheats: Fixed "Delete Selected Cheats" button

This commit is contained in:
Souryo 2016-07-29 17:35:25 -04:00
parent 8ac15c6f53
commit 32732caaa1
2 changed files with 22 additions and 1 deletions

View File

@ -154,7 +154,7 @@ namespace Mesen.GUI.Forms.Cheats
this.mnuAddCheat,
this.mnuDeleteCheat});
this.contextMenuCheats.Name = "contextMenuCheats";
this.contextMenuCheats.Size = new System.Drawing.Size(160, 48);
this.contextMenuCheats.Size = new System.Drawing.Size(160, 70);
//
// mnuAddCheat
//
@ -171,6 +171,7 @@ namespace Mesen.GUI.Forms.Cheats
this.mnuDeleteCheat.ShortcutKeys = System.Windows.Forms.Keys.Delete;
this.mnuDeleteCheat.Size = new System.Drawing.Size(159, 22);
this.mnuDeleteCheat.Text = "Delete";
this.mnuDeleteCheat.Click += new System.EventHandler(this.mnuDeleteCheat_Click);
//
// flowLayoutPanel2
//
@ -205,6 +206,7 @@ namespace Mesen.GUI.Forms.Cheats
this.btnDeleteCheat.TabIndex = 3;
this.btnDeleteCheat.Text = "Delete Selected Cheats";
this.btnDeleteCheat.UseVisualStyleBackColor = true;
this.btnDeleteCheat.Click += new System.EventHandler(this.btnDeleteCheat_Click);
//
// tableLayoutPanel2
//

View File

@ -87,5 +87,24 @@ namespace Mesen.GUI.Forms.Cheats
mnuDeleteCheat.Enabled = enableDelete;
btnDeleteCheat.Enabled = enableDelete;
}
private void DeleteSelectedCheats()
{
foreach(var item in lstCheats.SelectedItems) {
CheatInfo cheat = ((ListViewItem)item).Tag as CheatInfo;
ConfigManager.Config.Cheats.Remove(cheat);
}
UpdateCheatList();
}
private void btnDeleteCheat_Click(object sender, EventArgs e)
{
DeleteSelectedCheats();
}
private void mnuDeleteCheat_Click(object sender, EventArgs e)
{
DeleteSelectedCheats();
}
}
}