public void DeleteCheat(NSWindow window) { if (CheatTableView.SelectedRow == -1) { var alert = new NSAlert { AlertStyle = NSAlertStyle.Critical, InformativeText = NSBundle.MainBundle.LocalizedString("Please select the cheat to remove from the list of cheats.", null), MessageText = NSBundle.MainBundle.LocalizedString("Delete Cheat", null), }; alert.BeginSheet(window); } else { SelectedCheat = _cheats.GetItem <CheatModel>((nuint)CheatTableView.SelectedRow); var message = NSBundle.MainBundle.LocalizedString("Are you sure you want to delete cheat `{0:X}` from the table?", null); // Confirm delete var alert = new NSAlert { AlertStyle = NSAlertStyle.Critical, InformativeText = string.Format(message, SelectedCheat.Address), MessageText = NSBundle.MainBundle.LocalizedString("Delete Cheat", null), }; alert.AddButton(NSBundle.MainBundle.LocalizedString("OK", null)); alert.AddButton(NSBundle.MainBundle.LocalizedString("Cancel", null)); alert.BeginSheetForResponse(window, (result) => { // Delete? if (result == 1000) { RemoveCheat(CheatTableView.SelectedRow); } }); } }
public void EditCheat(NSWindow window) { if (CheatTableView.SelectedRow == -1) { var alert = new NSAlert { AlertStyle = NSAlertStyle.Informational, InformativeText = NSBundle.MainBundle.LocalizedString("Please select the cheat to edit from the list of cheats.", null), MessageText = NSBundle.MainBundle.LocalizedString("Edit Cheat", null), }; alert.BeginSheet(window); } else { SelectedCheat = _cheats.GetItem <CheatModel>((nuint)CheatTableView.SelectedRow); PerformSegue("EditorSegue", this); } }
public void InsertCheat(CheatModel cheat, nint index) { WillChangeValue("cheatModelArray"); _cheats.Insert(cheat, index); DidChangeValue("cheatModelArray"); }
public void AddCheat(CheatModel cheat) { WillChangeValue("cheatModelArray"); _cheats.Add(cheat); DidChangeValue("cheatModelArray"); }