public GuessingGame(IHTMLElement e) { // e.innerHTML = @"<h1> Try to guess a 5-figure integer </h1> "; e.appendChild(HintControl, StatusControl, NumberBar); StatusControl.style.color = Color.Blue; Control = e; ResetButton.onclick += delegate { new GuessingGame(Control); }; MyGame.Changed += delegate { HintControl.innerHTML = "<h2>You have guessed " + MyGame.GuessedValues.length + " times"; StatusControl.innerHTML = MyGame.MaskedValue; if (MyGame.Done) { NumberBar.FadeOut(); StatusControl.innerHTML += "<hr /> game over"; Control.appendChild(ResetButton); } }; MyGame.RaiseChanged(); for (int i = 0; i < 10; i++) { IHTMLButton btn = new IHTMLButton(i + ""); int ux = i; btn.onclick += delegate { MyGame.Guessed(ux); btn.FadeOut(); }; NumberBar.appendChild(btn); } Style.textAlign = IStyle.TextAlignEnum.center; Style.backgroundColor = Color.System.ButtonFace; Style.borderColor = Color.Gray; Style.borderWidth = "1px"; Style.borderStyle = "dotted"; Style.padding = "8px"; }