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

Remove the rest of Bindable<> properties from Room #30631

Closed

Conversation

smoogipoo
Copy link
Contributor

Prereqs:

This covers most of the other less-important/"visual" properties from the room, building on the structure set by #30598. The first 1-2 commits are a bit chonky but the rest should be easy to parse commit-by-commit (NRT-related changes stopped happening).

BindableList<> properties are not included here because they're a bit more complicated.

In general, most relevant implementations take the form:

protected override void LoadComplete()
{
    base.LoadComplete();

    room.PropertyChanged += onRoomPropertyChanged;
    updateRoomName();
}

private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
    switch (e.PropertyName)
    {
        case nameof(Room.Name):
            updateRoomName();
            break;
    }
}

private void updateRoomName()
{
}

protected override void Dispose(bool isDisposing)
{
    base.Dispose(isDisposing);
    room.PropertyChanged -= onRoomPropertyChanged;
}

I've done by best to ensure every += is matched with a -=, and to do this I've kept everything structurally identical so it can be searched by text. You're going to have to excuse the method duplication for now, I don't know whether it's best to separate it like that or to go with something like:

protected override void LoadComplete()
{
    base.LoadComplete();

    room.PropertyChanged += onRoomPropertyChanged;
    onRoomPropertyChanged(null, nameof(Room.Name);
}

private void onRoomPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
    switch (e.PropertyName)
    {
        case nameof(Room.Name):
            /* update */
            break;
    }
}

Will figure that part out as a follow up.

@smoogipoo
Copy link
Contributor Author

Test failures are not... relevant 😅

@smoogipoo smoogipoo closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant