private void InsertPage(TextProcessorCommand command) { var pages = m_helper.Controller.GetObjectNames("object", true).Where(n => n != "player").OrderBy(n => n); var result = PopupEditors.EditStringWithDropdown("Link text", string.Empty, "Add link to", pages, pages.First(), allowEmptyString: true); if (!result.Cancelled) { InsertText( command.InsertBefore + result.ListResult + (result.Result.Length > 0 ? ":" + result.Result : "") + command.InsertAfter, string.Empty); } }
private void InsertObject(TextProcessorCommand command) { var objects = m_helper.Controller.GetObjectNames("object", true).OrderBy(n => n); var result = PopupEditors.EditStringWithDropdown( "Please choose an object", string.Empty, null, null, string.Empty, objects); if (!result.Cancelled) { InsertText(command.InsertBefore + result.Result + command.InsertAfter, string.Empty); } }
private void InsertExit(TextProcessorCommand command) { var text = L.T("EditorKeypromptEnterExitName"); var objects = m_helper.Controller.GetObjectNames("exit", true).OrderBy(n => n); var result = PopupEditors.EditStringWithDropdown( text, string.Empty, null, null, string.Empty, objects); if (!result.Cancelled) { InsertText(command.InsertBefore + result.Result + command.InsertAfter, string.Empty); } }
private void InsertFromList(string itemName, IEnumerable <string> items) { var result = PopupEditors.EditStringWithDropdown( string.Format("Please enter {0} name", itemName), string.Empty, null, null, "", items); if (result.Cancelled) { txtExpression.Focus(); return; } InsertString(result.Result); }
private void cmdAddType_Click(object sender, EventArgs e) { if (m_readOnly) { return; } var availableTypes = m_controller.GetElementNames("type") .Where(t => !lstTypes.Items.ContainsKey(t)) .Where(t => !m_controller.IsDefaultTypeName(t)) .OrderBy(t => t); var result = PopupEditors.EditStringWithDropdown(L.T("EditorChooseTypeToAdd"), string.Empty, null, null, string.Empty, availableTypes); if (result.Cancelled) { return; } if (!availableTypes.Contains(result.Result)) { if (lstTypes.Items.ContainsKey(result.Result)) { MessageBox.Show(string.Format("Type '{0}' is already inherited", result.Result), "Invalid type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show(string.Format("Type '{0}' does not exist", result.Result), "Invalid type", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return; } var addResult = m_controller.AddInheritedTypeToElement(m_data.Name, result.Result, true); if (!addResult.Valid) { PopupEditors.DisplayValidationError(addResult, null, "Unable to add type"); } }