/** * Prompts user to confirm an action, if they agree delegate will be executed. * @param action The action to perform if the use clicks "OK" * @param text The text to show on the confirmation window */ static public void ConfirmAction(SimpleEvent action, string text) { var state = new ModalDecisionState("Are you sure?", text); state.OnYes += action; PushState(state); }
public override bool Transact(IDragDrop source) { if ((source == null) || !(source is GuiItemSlot)) { return(false); } var modal = new ModalDecisionState("Are you sure?", "Do you want to destroy " + source.DDContent + "?\nThis item will be permanently destroyed."); modal.OnNo += delegate { // nothing to do. }; modal.OnYes += delegate { (source as GuiItemSlot).DataLink.ItemInstance = null; }; Engine.PushState(modal); return(false); }