public SingleplayerWindow()
 {
     InitializeComponent();
     backgroundMusic.Open(new Uri("sounds/gameMusic.mp3", UriKind.RelativeOrAbsolute));
     backgroundMusic.Play();
     Backgr.ImageSource = new BitmapImage(new Uri("images/backgame.png", UriKind.Relative));
     score            = 0;
     Width            = width + 100;
     foodCanvas.Width = canvas.Width = width;
     canvas.Height    = foodCanvas.Height = Height = height;
     myGrid.Height    = height;
     myGrid.Children.Add(new Rectangle
     {
         Height = height, Width = 100, StrokeDashCap = PenLineCap.Round,
         Stroke = Brushes.Gray
     });
     bestScore.Text   = ScoreClass.GetBestScore();
     time             = new DispatcherTimer();
     currentDurection = Directions.Stay;
     snakeBody        = new List <SnakeElement>();
     snakeBody.Add(new SnakeElement(new Point(moveSize, moveSize)));
     snakeBody[0].rectangle.Fill = SettingsClass.PlayerColor;
     time.Interval =
         new TimeSpan(0, 0, 0, 0, SettingsClass.Difficulty);
     time.Tick += time_Tick;
 }