Added an event for a changed translation
This commit is contained in:
parent
1071439348
commit
6101f49f44
@ -23,4 +23,14 @@ internal static class AppEvents
|
|||||||
internal static void TextElementChanged(TextElement? textElement) => WhenTextElementChanged?.Invoke(null, textElement);
|
internal static void TextElementChanged(TextElement? textElement) => WhenTextElementChanged?.Invoke(null, textElement);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Translation was changed
|
||||||
|
|
||||||
|
// Translation changed event which can be subscribed:
|
||||||
|
internal static event EventHandler<Translation?> WhenTranslationChanged;
|
||||||
|
|
||||||
|
// Method to raise the translation changed event:
|
||||||
|
internal static void TranslationChanged(Translation? translation) => WhenTranslationChanged?.Invoke(null, translation);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
@ -124,7 +124,10 @@ public sealed partial class Translation : UserControl
|
|||||||
private async void SaveChanges(object? sender, ElapsedEventArgs e)
|
private async void SaveChanges(object? sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.currentTranslationId > -1)
|
if (this.currentTranslationId > -1)
|
||||||
await TranslationProcessor.SaveChangedTranslation(this.currentTranslationId, this.textBox.Text, this.checkBoxManual.Checked);
|
{
|
||||||
|
var storedTranslation = await TranslationProcessor.SaveChangedTranslation(this.currentTranslationId, this.textBox.Text, this.checkBoxManual.Checked);
|
||||||
|
AppEvents.TranslationChanged(storedTranslation.Result);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.ParentForm is UI_WinForms.Main main)
|
if(this.ParentForm is UI_WinForms.Main main)
|
||||||
main.RemoveDeferredSaveOperation(this.currentTranslationId);
|
main.RemoveDeferredSaveOperation(this.currentTranslationId);
|
||||||
|
Loading…
Reference in New Issue
Block a user