Prevent storing data after pre-filling

This commit is contained in:
Thorsten Sommer 2022-09-20 19:31:09 +02:00
parent d9629ab53d
commit d521aca2f7
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -10,6 +10,7 @@ public sealed partial class Translation : UserControl
private readonly Timer saveTimer; private readonly Timer saveTimer;
private int currentTranslationId = -1; private int currentTranslationId = -1;
private bool isLoading = false;
public Translation() public Translation()
{ {
@ -40,13 +41,20 @@ public sealed partial class Translation : UserControl
public void Configure(DataModel.Database.Translation translation) public void Configure(DataModel.Database.Translation translation)
{ {
this.isLoading = true;
this.currentTranslationId = translation.Id; this.currentTranslationId = translation.Id;
this.textBox.Multiline = translation.TextElement.IsMultiLine; this.textBox.Multiline = translation.TextElement.IsMultiLine;
this.textBox.Text = translation.Text; this.textBox.Text = translation.Text;
this.isLoading = false;
} }
private async void textBox_TextChanged(object sender, EventArgs e) private async void textBox_TextChanged(object sender, EventArgs e)
{ {
if(this.isLoading)
return;
if(this.saveTimer.Enabled) if(this.saveTimer.Enabled)
this.saveTimer.Stop(); this.saveTimer.Stop();