diff --git a/PKHeX.WinForms/Program.cs b/PKHeX.WinForms/Program.cs index ec0042b49..4255e9ea5 100644 --- a/PKHeX.WinForms/Program.cs +++ b/PKHeX.WinForms/Program.cs @@ -36,7 +36,7 @@ private static void Main() new Task(() => splash.ShowDialog()).Start(); new Task(() => EncounterEvent.RefreshMGDB(WinForms.Main.MGDatabasePath)).Start(); var main = new Main(); - splash.Invoke(splash.ForceClose); + splash.BeginInvoke(splash.ForceClose); Application.Run(main); } diff --git a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs index f48f0740d..0d484a766 100644 --- a/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs +++ b/PKHeX.WinForms/Subforms/PKM Editors/BatchEditor.cs @@ -204,22 +204,15 @@ void process(IList d) } // Progress Bar - private void SetupProgressBar(int count) + private void SetupProgressBar(int count) => PB_Show.BeginInvoke(() => { - MethodInvoker mi = () => { PB_Show.Minimum = 0; PB_Show.Step = 1; PB_Show.Value = 0; PB_Show.Maximum = count; }; - if (PB_Show.InvokeRequired) - PB_Show.Invoke(mi); - else - mi.Invoke(); - } + PB_Show.Minimum = 0; + PB_Show.Step = 1; + PB_Show.Value = 0; + PB_Show.Maximum = count; + }); - private void SetProgressBar(int position) - { - if (PB_Show.InvokeRequired) - PB_Show.Invoke((MethodInvoker)(() => PB_Show.Value = position)); - else - PB_Show.Value = position; - } + private void SetProgressBar(int position) => PB_Show.BeginInvoke(() => PB_Show.Value = position); private void ProcessSAV(IList data, IReadOnlyList Filters, IReadOnlyList Instructions) { @@ -239,7 +232,10 @@ private void ProcessSAV(IList data, IReadOnlyList var spec = pk.Species; if (spec == 0 || spec > max) + { + b.ReportProgress(i); continue; + } if (entry.Source is SlotInfoBox info && SAV.GetSlotFlags(info.Box, info.Slot).IsOverwriteProtected()) editor.AddSkipped(); diff --git a/PKHeX.WinForms/Subforms/SAV_FolderList.cs b/PKHeX.WinForms/Subforms/SAV_FolderList.cs index 00a6e67a9..7f570cdea 100644 --- a/PKHeX.WinForms/Subforms/SAV_FolderList.cs +++ b/PKHeX.WinForms/Subforms/SAV_FolderList.cs @@ -30,6 +30,8 @@ public SAV_FolderList(Action openSaveFile) dgDataRecent.ContextMenuStrip = GetContextMenu(dgDataRecent); dgDataBackup.ContextMenuStrip = GetContextMenu(dgDataBackup); + dgDataRecent.Sorted += (_, _) => GetFilterText(dgDataRecent); + dgDataBackup.Sorted += (_, _) => GetFilterText(dgDataBackup); var extra = Paths.Select(z => z.Path).Where(z => z != Main.BackupPath).Distinct(); var backup = SaveFinder.GetSaveFiles(drives, false, [Main.BackupPath], false); @@ -274,17 +276,15 @@ private SaveList PopulateData(DataGridView dgData, IEnumerable LoadEntry(dgData, list, sav); - dgData.Invoke(Load); + dgData.BeginInvoke(Load); ctr++; if (ctr < 15 && ctr % 7 == 0) - dgData.Invoke(RefreshResize); + dgData.BeginInvoke(RefreshResize); } - dgData.Invoke(RefreshResize); + dgData.BeginInvoke(RefreshResize); enumerator.Dispose(); }); - dgData.Sorted += (_, _) => GetFilterText(dgData); - return list; }