Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/filecleanup-improvement' into fi…
Browse files Browse the repository at this point in the history
…lecleanup-improvement
  • Loading branch information
bagusnl committed Dec 19, 2024
2 parents 442fcf4 + a65b937 commit 5edc9c6
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions CollapseLauncher/XAMLs/MainApp/Pages/FileCleanupPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,34 @@ await Task.Run(() =>
sI.Stop();
Logger.LogWriteLine($"[FileCleanupPage::InjectFileInfoSource] Finished batch #{b} with {batch.Count} items after {s.ElapsedMilliseconds} ms", LogType.Scheme);
b++;
sI = null;
}));

}
});
await Task.WhenAll(tasks);

await EnqueueOnDispatcherQueueAsync(() =>
{
var i = 0;
var sI = new Stopwatch();
sI.Start();
while (_localFileCollection.Count > 0)
if (_localFileCollection.Count > 0)
{
await EnqueueOnDispatcherQueueAsync(() =>
{
FileInfoSource.Add(_localFileCollection[0]);
_localFileCollection.RemoveAt(0);
i++;
}

sI.Stop();
Logger
.LogWriteLine($"[FileCleanupPage::InjectFileInfoSource] Finished last batch at #{b} after {i} items",
LogType.Scheme);
});

var i = 0;
var sI = new Stopwatch();
sI.Start();
while (_localFileCollection.Count > 0)
{
FileInfoSource.Add(_localFileCollection[0]);
_localFileCollection.RemoveAt(0);
i++;
}

sI.Stop();
Logger
.LogWriteLine($"[FileCleanupPage::InjectFileInfoSource] Finished last batch at #{b} after {i} items in {sI.ElapsedMilliseconds} ms",
LogType.Scheme);
});
}

while (_localFileCollection.Count != 0)
{
FileInfoSource.Add(_localFileCollection[0]);
Expand All @@ -133,7 +137,6 @@ await EnqueueOnDispatcherQueueAsync(() =>
DeleteSelectedFilesText.Text =
string.Format(Locale.Lang._FileCleanupPage.BottomButtonDeleteSelectedFiles, 0);
}

}

private void UpdateUIOnCollectionChange(object? sender, NotifyCollectionChangedEventArgs? args)
Expand Down

0 comments on commit 5edc9c6

Please sign in to comment.