Implemented copy function for text element's keys

This commit is contained in:
tsommer committed 2023-02-15 20:32:47 +01:00
1 parent bbc10de9ff
commit 8314e7157b
4 files changed
+48 -18

No files matched your search

@@ -86,6 +86,13 @@ public partial class TextElements : UserControl
}
}
};
// When the user press Ctrl + C, copy the text element's key to the clipboard:
this.listTextElements.KeyDown += (sender, e) =>
{
if (e is {Control: true, KeyCode: Keys.C})
this.buttonCopyKey.PerformClick();
};
}
// Loads all the text elements for the current section.
@@ -236,8 +243,11 @@ public partial class TextElements : UserControl
private async void textBoxFilter_KeyUp(object sender, KeyEventArgs e) => await this.LoadTextElements();
private void buttonCopyKey_Click(object sender, EventArgs e)
private async void buttonCopyKey_Click(object sender, EventArgs e)
{
if(this.DesignMode || this.currentTextElement is null)
return;
Clipboard.SetText(await TextElementProcessor.GetKey(this.currentTextElement.Id));
}
}