/// <summary> /// Shows a dialog to configure a custom argument to provide the Run action. /// </summary> /// <param name="list"></param> /// <param name="callback"></param> private static void RequestRunArgument(IList <TerminalActionParameter> list, Action <bool> callback) { // TODO: allocations, needs GUI redo MyGuiScreenDialogText dialog = new MyGuiScreenDialogText(string.Empty, MySpaceTexts.DialogText_RunArgument); dialog.OnConfirmed += argument => { list[0] = TerminalActionParameter.Get(argument); callback(true); }; MyGuiSandbox.AddScreen(dialog); }
/// <summary> /// Opens the dialog to add a subtype id to the given table /// </summary> /// <param name="table">Table to add item to</param> /// <param name="addAction">Action, which should add the id to the settings file</param> private void OpenEnterIdDialog(MyGuiControlTable table, Action <string> addAction) { MyGuiScreenDialogText inputBox = new MyGuiScreenDialogText(); inputBox.OnConfirmed += delegate(string text) { if (Regex.Match(text, ILLEGAL_XML).Success) { MyPluginGuiHelper.DisplayError("The entered subtype id contains invalid characters (& < >).", "Error, invalid character"); return; } var row = new MyGuiControlTable.Row(text); row.AddCell(new MyGuiControlTable.Cell(text)); table.Add(row); addAction(text); }; MyGuiSandbox.AddScreen(inputBox); }