private void btnRemoveSelected_Click(object sender, EventArgs e) { if (mobGrid.SelectedRows.Count > 0) { int index = mobGrid.SelectedRows[0].Index; var tarID = (uint)mobGrid["MobID", index].Value; if (tarID > 0) { var Target = TargetManager.AltarboySpecialTargets.First(tar => tar.TargetId == tarID); if (Target != null) { TargetManager.AltarboySpecialTargets.Remove(Target); TargetManager.SaveSpecialTargets(); } } } }
private void btnAddMobToList_Click(object sender, EventArgs e) { if (StyxWoW.Me.CurrentTarget != null || StyxWoW.Me.CurrentTarget.IsPlayer) { var newTarget = new SpecialTarget { TargetName = StyxWoW.Me.CurrentTarget.Name, TargetId = StyxWoW.Me.CurrentTarget.Entry, }; //Don't create a new record if there is one. if (!TargetManager.AltarboySpecialTargets.Any(tar => tar.TargetId == newTarget.TargetId)) { TargetManager.AltarboySpecialTargets.Add(newTarget); TargetManager.SaveSpecialTargets(); Logger.Log("Current target entry - (" + newTarget.TargetId + ") " + newTarget.TargetName); } } }
//private void mobGrid_SelectionChanged(object sender, EventArgs e) //{ // if(mobGrid.SelectedRows.Count > 0) // { // int index = mobGrid.SelectedRows[0].Index; // uint targetID = (uint)mobGrid["MobID", index].Value; // lblTargetName.Text = TargetManager.AltarboySpecialTargets.First(tar => tar.TargetId == targetID).TargetName; // } //} private void mobGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e) { TargetManager.SaveSpecialTargets(); //SaveSettings(); }