Merge pull request #6745 from ivandrofly/develop

Freeze listview UI when updated item
This commit is contained in:
Nikolaj Olsson 2023-03-14 01:04:44 -04:00 committed by GitHub
commit 8637d130bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,6 +211,7 @@ namespace Nikse.SubtitleEdit.Forms
private void AddListViewItem(string fileName)
{
listViewSubtitles.BeginUpdate();
if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
{
return;
@ -250,6 +251,7 @@ namespace Nikse.SubtitleEdit.Forms
IsDefault = false,
FileName = fileName,
});
listViewSubtitles.EndUpdate();
}
private void buttonCancel_Click(object sender, EventArgs e)
@ -594,7 +596,9 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonClear_Click(object sender, EventArgs e)
{
listViewSubtitles.BeginUpdate();
listViewSubtitles.Items.Clear();
listViewSubtitles.EndUpdate();
_softSubs.Clear();
labelSubtitles.Text = string.Format(LanguageSettings.Current.GenerateVideoWithEmbeddedSubs.SubtitlesX, listViewSubtitles.Items.Count);
}
@ -635,6 +639,7 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
listView.BeginUpdate();
var item = listView.SelectedItems[0];
listView.Items.RemoveAt(idx);
@ -644,6 +649,7 @@ namespace Nikse.SubtitleEdit.Forms
idx++;
listView.Items.Insert(idx, item);
listView.EndUpdate();
}
private void MoveToTop(ListView listView)
@ -659,6 +665,7 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
listView.BeginUpdate();
var item = listView.SelectedItems[0];
listView.Items.RemoveAt(idx);
@ -668,6 +675,7 @@ namespace Nikse.SubtitleEdit.Forms
idx = 0;
listView.Items.Insert(idx, item);
listView.EndUpdate();
}
private void ButtonMoveSubUp_Click(object sender, EventArgs e)