-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized Progress Bar, Displays based on Operation Duration #24013
base: master
Are you sure you want to change the base?
Conversation
I intend to remove the progressbar for less then or equal to 5 file, to make it less anoying TODO: Check for errors when running Remove-Item
Made it so that the progress bar for removing only appears after the _removeStopwatch reaches 600ms
Made the copy and remove command display the Progress bar only after the process is lasting more then 200ms
…econds Made it so that instead of skipping it all together, only the instance will not be shown until 3 seconds elapse, the calculations will still continue
Changed the Creating of the Progress Bar's instance to be after 3 seconds
src/System.Management.Automation/namespaces/FileSystemProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/namespaces/FileSystemProvider.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/namespaces/FileSystemProvider.cs
Outdated
Show resolved
Hide resolved
Fixed Indentation for IF as Guidelines Say and Switched the Duration const to PascalCase
Fixed Indentation, Removed Empty Spaces, and Switched Const to PascalCase
@TheSpyGod if you don't want to agree to the CLA, I'll submit a new PR to address this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed the indentation issue
@microsoft-github-policy-service agree |
progress.PercentComplete = percentComplete; | ||
progress.RecordType = ProgressRecordType.Processing; | ||
WriteProgress(progress); | ||
if (_removeStopwatch.Elapsed.TotalSeconds > ProgressBarDurationThreshold) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double speed = ...
should be moved under follow if
.
progress.PercentComplete = percentComplete; | ||
progress.RecordType = ProgressRecordType.Processing; | ||
WriteProgress(progress); | ||
if (_copyStopwatch.Elapsed.TotalSeconds > ProgressBarDurationThreshold) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same.
PR Summary
I've optimized the Progress Bar of the Copy and Remove commands to display only after the operation lasts more then 200ms, otherwise do the operation without a Progress Bar, I've done this by adding to the IF conditional of IF _copyStopwatch or _removeStopwatch Elapsed time is higher then 0.2 seconds(200ms) add the Progress Bar to the process.
PR Context
Fix #23831
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.- [ ] Issue filed:
(which runs in a different PS Host).