Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LakeishaKowalczyk committed Sep 19, 2024
1 parent dbfac67 commit c3b6d76
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/ui/Forms/Translate/AutoTranslate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,7 @@
using Timer = System.Windows.Forms.Timer;

namespace Nikse.SubtitleEdit.Forms.Translate
{

// 调试用窗体
public partial class StatusForm : Form
{
public StatusForm()
{
InitializeComponent();
}

public void UpdateStatus(int retryAttempts, int linesMergedAndTranslated)
{
this.labelStatus.Text = $"Retry Attempts: {retryAttempts}\nLines Merged and Translated: {linesMergedAndTranslated}";
}
}
{
public sealed partial class AutoTranslate : Form
{
public Subtitle TranslatedSubtitle { get; }
Expand Down Expand Up @@ -886,24 +872,11 @@ private async void buttonTranslate_Click(object sender, EventArgs e)
Application.DoEvents();


// 调试用窗体
StatusForm statusForm = new StatusForm();
statusForm.Show();


// 当翻译结果为空时重试 MaxRetryAttempts 次
// 当翻译结果为空时重试 MaxRetryAttempts 次
int retryAttempts = 0;
var linesMergedAndTranslated = 0;
do
{

// 更新状态窗体中的信息
statusForm.Invoke((Action)(() =>
{
statusForm.UpdateStatus(retryAttempts, linesMergedAndTranslated);
}));


linesMergedAndTranslated = await MergeAndSplitHelper.MergeAndTranslateIfPossible(_subtitle, TranslatedSubtitle, source, target, index, _autoTranslator, forceSingleLineMode, _cancellationTokenSource.Token);
Application.DoEvents();

Expand Down

0 comments on commit c3b6d76

Please sign in to comment.