protected bool SendOnRemove(int index) { bool doIt = true; if (null != OnRemove) { foreach (EventHandler <CancelSelectEventArgs <int> > inv in OnRemove.GetInvocationList()) { try { CancelSelectEventArgs <int> args = new CancelSelectEventArgs <int>(index); inv(this, args); if (args.Cancel) { doIt = false; } } catch (Exception exception) { Log.postException(exception); } } } return(doIt); }
public void OnPresetRemove(object sender, CancelSelectEventArgs <int> e) { DialogOption[] options = new DialogOption[2]; options[0] = new DialogOption("Yes", () => { ProcAirships.Instance.Presets.Remove(Presets[e.Index]); RefreshPresets(); }); options[1] = new DialogOption("No", () => { }); MultiOptionDialog diag = new MultiOptionDialog("Really delete this preset?", windowTitle: "Are you sure?", options: options); PopupDialog.SpawnPopupDialog(diag, false, HighLogic.Skin); }