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

Improve collection-based UI #41

Open
Tracked by #34
Craftplacer opened this issue Aug 7, 2021 · 0 comments
Open
Tracked by #34

Improve collection-based UI #41

Craftplacer opened this issue Aug 7, 2021 · 0 comments
Assignees
Labels
code quality enhancement New feature or request
Projects

Comments

@Craftplacer
Copy link
Collaborator

Craftplacer commented Aug 7, 2021

Currently most SCTT components compare UI against data, this is possible to improve, I'd suggest this:

  1. probably make event/interface/class for item changes
  2. for static updates/fetches/pulls, you compare those two collections and call events accordingly

I imagine sharing one base class/interface for either event-based updates or pulling.

Examples of old code

Most of SCTT's current code is like this.

List<Item> newItems = new();
foreach (var item in SomeItemSource)
{
    newItems.Add(item);
    if (!items.Contains(item))
    {
        /* some init here */
        items.Add(item);
    }
}

foreach (var item in items)
{
    if (!newItems.Contains(item))
    {
        _ = items.Remove(item);
        item.Dispose();
    }
}

/* additional processing here */
@Craftplacer Craftplacer added enhancement New feature or request help wanted Extra attention is needed code quality labels Aug 7, 2021
@Craftplacer Craftplacer added this to In progress in Refactor Aug 14, 2021
@Craftplacer Craftplacer self-assigned this Aug 26, 2021
@Craftplacer Craftplacer removed the help wanted Extra attention is needed label Aug 26, 2021
@Craftplacer Craftplacer moved this from In progress to Done in Refactor Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality enhancement New feature or request
Projects
Refactor
  
Done
Development

No branches or pull requests

1 participant