Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

TheSpyGod
Copy link

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

TheSpyGod and others added 4 commits July 3, 2024 22:30
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
@TheSpyGod TheSpyGod requested a review from anmenaga as a code owner July 4, 2024 19:15
TheSpyGod and others added 2 commits July 5, 2024 14:29
…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
TheSpyGod and others added 2 commits July 5, 2024 19:41
Fixed Indentation for IF as Guidelines Say and Switched the Duration const to PascalCase
Fixed Indentation, Removed Empty Spaces, and Switched Const to PascalCase
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Jul 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Review - Needed The PR is being reviewed labels Aug 5, 2024
@SteveL-MSFT
Copy link
Member

@TheSpyGod if you don't want to agree to the CLA, I'll submit a new PR to address this

Copy link
Member

@SteveL-MSFT SteveL-MSFT left a 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

@TheSpyGod
Copy link
Author

@microsoft-github-policy-service agree

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 13, 2024
progress.PercentComplete = percentComplete;
progress.RecordType = ProgressRecordType.Processing;
WriteProgress(progress);
if (_removeStopwatch.Elapsed.TotalSeconds > ProgressBarDurationThreshold)
Copy link
Collaborator

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove-Item progress should only be displayed if > 5 items
3 participants