コード例 #1
0
ファイル: DBAccess.cs プロジェクト: serij10/windows8_projects
 public void AddScoresToDb(Scores newScore)
 {
     appDB.scores.InsertOnSubmit(newScore);
     SaveChangesToDB();
     Debug.WriteLine("Inserted in DB");
 }
コード例 #2
0
        public void CheckWinner(TextBlock Congratulations)
        {
            bool completed = true;
            int totalPieces = colsAndRows * colsAndRows;
            for (int n = 0; n < totalPieces - 1; n++)
            {
                if (n != this.board[n])
                {
                    completed = false;
                    break;
                }
            }

            if (completed)
            {
                if (this.GameOver != null)
                {
                    Congratulations.Visibility = Visibility.Visible;
                    Congratulations.Opacity = 1;
                    this.GameOver(this, new GameOverEventArgs { TotalMoves = this.totalMoves });
                    Scores newScore = new Scores
                    {
                        Date = DateTime.Now,
                        Moves = this.totalMoves
                    };
                    App.ViewModel.AddScoresToDb(newScore);
                    App.ViewModel.SaveChangesToDB();
                }
            }
        }