-
Notifications
You must be signed in to change notification settings - Fork 254
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
[NUI] Notify background change with magic keyword #6496
base: DevelNUI
Are you sure you want to change the base?
Conversation
@@ -944,6 +944,7 @@ public Color BackgroundColor | |||
SetInternalBackgroundColorProperty(this, null, value); | |||
} | |||
NotifyPropertyChanged(); | |||
NotifyPropertyChanged("_background"); |
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.
직접 말씀드리긴 했지만,
NotifyPropertyChanged가 중복으로 호출되는 형태가 추후에 다른 사람이 이 코드를 봤을 때 어떤 목적이나 역할인지 이해하기 다소 난해한 부분이 있을 것 같습니다. 주석 등으로 왜 이런 코드가 추가 되었는지 기록을 남겨두는 편이 좋을 것 같습니다.
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.
네 수정했습니다~
Signed-off-by: Jiyun Yang <[email protected]>
63eb65c
to
ae7b528
Compare
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.
looks good to me
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.
Looks good to me.
// NOTE | ||
// Notify background modifications caused by one of BackgroundColor, BackgroundImage, Background and ClearBackground() | ||
// By using reserved keyword "_background", user may get notified all background modifications. | ||
NotifyPropertyChanged("_background"); |
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.
Just my curiosity :
Normally, when we add the string here for PropertyChanged
, we use the Pascal case. like "Background".
Is there any reason for using snake_case like this with an underscore?
Probably, is it to have different usage from general 'Background'?
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.
View
has Background
property (PropertyMap
type) and it's using pascal case Background
keyword!
To distinguish from it I decided to add prefix "_" which can have private meaning. (it looks like snake case but it's just prefix. For example, _somePrivateFieldName
)
Description of Change
NUI 외부 라이브러리에서 백그라운드를 토큰 형식으로 지원하기 위해 아래와 같은 기능을 추가했습니다.
설명
백그라운드를 토큰으로 지원하려면 백그라운드 변경에 대한 노티를 받을 수 있어야 함.
View
는 bindable object를 상속하는 구조로PropertySet
이벤트를 제공하고 있어 토큰 구현에 사용할 수 있음.그런데 백그라운드는 서로 다른 프로퍼티간 상호 수정이 일어나는 구조임.
이런 구조에서, 기존에 제공하던
PropertySet
이벤트는 아래의 이유로 사용하기 어려움이 있음이를 해결하기 위해
_background
라는 매직 키워드를 사용하여 백그라운드가 어떤 식으로든지 변경되었다는 노티 줄 수 있도록 조치하여 internal 구현에서 활용할 수 있게 함API Changes