private void buttonClick(object sender, EventArgs e) { if (canPlay) { String[] tokens = ((Button)sender).Text.Split(' '); int i = Int32.Parse(tokens[0]); int j = Int32.Parse(tokens[1]); lightsOut.change(i, j); lightsOut.updateBoard(buttons); score--; scoreLabel.Text = score.ToString(); if (score > 0) { if (hasWon()) { canPlay = false; title.Text = "YOU WON"; ScoreRelated.totalScore += score / 100d; ScoreRelated.UpdateScore(); } } else { title.Text = "YOU'VE LOST"; } } }
protected override void OnStart() { // Handle when your app starts ScoreRelated.UpdateScore(); }