Skip to content

Conversation

@mdtauk
Copy link
Contributor

@mdtauk mdtauk commented Aug 12, 2024

Resolved / Related Issues
This adds StorageBar and StorageRing controls to the Files.App.Controls project for future use, as well as a test page in the UITests app for testing behaviour.

image

image

image

I am no expert when it comes to coding let alone making Controls, so I would appreciate these be given a thorough review to ensure there are no edge cases I have not anticipated, as well as general changes to improve the code by those with the expertise and experience. I will call out @yaira2 and @0x5bfa who have been seeing my progress via Discord as I was working on them. But also anyone with control and or mathematics experience who can ensure I am using the most optimal calculations for the angles and size calculations. @marcelwgn has contributed to the Community Toolkit so will be able to make some comments on my properties and general code quality.

I also want to indicate I took great inspiration from the RadialGuage control in the Toolkit, as well as the blogposts and sample code from Diederik Krols and his blog posts.

As well as Co-Pilot for maths queries and interpolation code suggestions, here are other posts I found helpful

@mdtauk
Copy link
Contributor Author

mdtauk commented Aug 12, 2024

A final round of cleaning up or adding comments to parts of the controls can be done soon, but I wanted to get the functional code in after working on it on and off outside of the repo and adding it to the repo over the past week or so

@mdtauk
Copy link
Contributor Author

mdtauk commented Aug 15, 2024

A final round of cleaning up or adding comments to parts of the controls can be done soon, but I wanted to get the functional code in after working on it on and off outside of the repo and adding it to the repo over the past week or so

This is done now

/// <summary>
/// Updates the RingShape path
/// </summary>
private void UpdatePath()
Copy link
Contributor

Choose a reason for hiding this comment

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

This method should be split into multiple smaller functions. Also, I think the comment is kind of redundant and can be left out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am breaking this up into smaller functions and updated comments

Copy link
Member

Choose a reason for hiding this comment

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

I think now is good?

var result = number % divider;

// Ensure the result is positive or zero
result = result < 0 ? result + divider : result;
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, this only works if number > -divider

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@0x5bfa How do you suggest I change the method to ensure it works correctly?

Copy link
Member

Choose a reason for hiding this comment

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

If you're ensuring it be positive or zero, can't it be 'result < 0 ? 0 : result'?

Copy link
Member

Choose a reason for hiding this comment

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

What kind of modulus is this?

@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Aug 27, 2024
@yaira2 yaira2 requested a review from marcelwgn October 14, 2024 21:24
Lamparter

This comment was marked as resolved.

Lamparter

This comment was marked as duplicate.

@yaira2 yaira2 marked this pull request as draft November 4, 2024 16:15
@0x5bfa 0x5bfa removed the ready for review Pull requests that are ready for review label Nov 5, 2024
@0x5bfa 0x5bfa self-assigned this Nov 5, 2024
@0x5bfa 0x5bfa force-pushed the mdta-StorageControls branch from 30650a1 to 9bc64c2 Compare November 7, 2024 03:21
@yaira2 yaira2 requested a review from 0x5bfa November 25, 2024 15:42
@yaira2 yaira2 force-pushed the mdta-StorageControls branch from 9bc64c2 to 5b8b66d Compare November 25, 2024 15:52
@yaira2 yaira2 marked this pull request as ready for review November 25, 2024 15:59
@yaira2 yaira2 added the ready for review Pull requests that are ready for review label Nov 25, 2024
@yaira2 yaira2 changed the title Code Quality - Added StorageBar and StorageRing Controls Code Quality: Added StorageBar and StorageRing Controls Nov 25, 2024
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed ready for review Pull requests that are ready for review labels Nov 25, 2024
@yaira2 yaira2 merged commit 08ab494 into files-community:main Nov 25, 2024
5 checks passed
@mdtauk mdtauk deleted the mdta-StorageControls branch January 10, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge Pull requests that are approved and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants