private void HandleNewName(string newName) { if (string.IsNullOrEmpty(newName)) { ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Error", bodyText: $"{itemTitle} names cannot be blank."); return; } if (nameTranslator(selectedItem) == newName) { //We don't care, it was set to the same thing return; } if (itemList.Cast <object>().Select(nameTranslator).Contains(newName)) { ModalDialog.ShowSimpleModal(ModalDialog.Mode.Accept, headerText: "Error", bodyText: $"{itemTitle} name \"{newName}\" already in use in this context."); return; } if (nameValidator != null && !nameValidator.Invoke(selectedItem, newName)) { return; } //Update Name nameUpdater(selectedItem, newName); buttonMap[selectedItem].GetComponentInChildren <Text>().text = newName; }
private void EditPressed() { ModalDialog.ShowInputModal(ModalDialog.Mode.InputConfirmCancel, headerText: "Edit Name", bodyText: $"Enter new name for \"{nameTranslator(selectedItem)}\".", inputCallback: EditCallback, inputType: inputType); }
private void DeletePressed() { ModalDialog.ShowCustomSimpleModal( headerText: $"Delete {itemTitle}", bodyText: $"Are you sure you want to delete \"{nameTranslator(selectedItem)}\"?", buttonALabel: "Delete", buttonBLabel: "Cancel", buttonCLabel: null, callback: DeleteCallback); }
public void Initialize() { instance = this; }
public ModalDialog() { instance = this; }