Implemented the delete function for text elements

This commit is contained in:
tsommer committed 2022-07-23 21:21:48 +02:00
1 parent e762cfe21e
commit 71936e5dcf
2 files changed
+31 -1

No files matched your search

@@ -102,9 +102,20 @@ public partial class TextElements : UserControl
this.column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
}
private void buttonRemove_Click(object sender, EventArgs e)
private async void buttonRemove_Click(object sender, EventArgs e)
{
if(this.DesignMode || this.currentTextElement is null)
return;
// Ask the user, if he really wants to remove the text element:
if(MessageBox.Show(this.currentTextElement.Translations.Count > 0 ? $"Are you sure, you want to remove the text element '{this.currentTextElement.Name}', its {this.currentTextElement.Translations.Count} translations and so on?" : $"Are you sure, you want to remove the text element '{this.currentTextElement.Name}'?", "Remove text element", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
return;
// Remove the text element1 from the database:
await TextElementProcessor.DeleteTextElement(this.currentTextElement.Id);
// Reload the data:
await this.LoadTextElements();
}
private async void buttonRename_Click(object sender, EventArgs e)