Пример #1
0
        private void scoreButton_Click(object sender, RoutedEventArgs e)
        {
            ScoreWindow scoreWindow = new ScoreWindow();

            scoreWindow.Show();
            ScoreContext scoreContext = new ScoreContext();
        }
Пример #2
0
        public ScoreWindow()
        {
            InitializeComponent();
            var scoreContext = new ScoreContext();
            var _scores      = new ObservableCollection <Score>(scoreContext.Set <Score>().Take(10).ToList());

            scores.ItemsSource = _scores;
        }
Пример #3
0
        private void updateScoreboard()
        {
            //Update score first.
            this.scoreTextBlock.Text = score.ToString();
            //Update best score next.
            if (score > bestScore)
            {
                bestScore = score;
            }
            this.bestScoreTextBlock.Text = bestScore.ToString();
            ScoreContext scoreContext = new ScoreContext();
            Score        scoreV       = new Score();

            scoreV.ScoreValue = bestScore;
            scoreContext.Scores.Add(scoreV);
            scoreContext.SaveChanges();
        }