ahmed
1
Hello, How i can use this code on C#:
public SignUpDialogBox() {
usernameTextBox.addEventHandler(this::controlChanged);
passwordTextBox.addEventHandler(this::controlChanged);
agreeToTermsCheckBox.addEventHandler(this::controlChanged);
}
private void controlChanged() {
signUpButton.setEnabled(isFormValid());
}
Thanks
I changed to inline class but it is more code. Maybe with c# event handler and delegates it is easier
public class ArticlesDialogBox
{
public class ArticleObserver : IObserver
{
ArticlesDialogBox articlesDialogBox;
public ArticleObserver(ArticlesDialogBox articlesDialogBox)
{
this.articlesDialogBox = articlesDialogBox;
}
public void update() => articlesDialogBox.articleSelected();
}
public class TitleObserver : IObserver
{
ArticlesDialogBox articlesDialogBox;
public TitleObserver(ArticlesDialogBox articlesDialogBox)
{
this.articlesDialogBox = articlesDialogBox;
}
public void update() => articlesDialogBox.titleChanged();
}
public ArticlesDialogBox()
{
articlesListBox.attach(new ArticleObserver(this));
titleTextBox.attach(new TitleObserver(this));
}