private void GameCompleted()
        {
            MessageBox.Show("Niice!", "Completed",
                            MessageBoxButton.OK, MessageBoxImage.Information);

            if (_playerName == "")
            {
                var mbResult = MessageBox.Show("Do you want to save your result?", "Saving results",
                                               MessageBoxButton.YesNo, MessageBoxImage.Information);

                if (mbResult == MessageBoxResult.Yes)
                {
                    PlayerNameDialog nameWindow = new PlayerNameDialog();

                    if (nameWindow.ShowDialog() == true)
                    {
                        _playerName = nameWindow.Name;
                    }
                }
                else
                {
                    LogHelper.Log(LogTarget.File, LogType.Info, $"Game completed without saving results.");
                }
            }
            if (_playerName != "")
            {
                using (FiveOursContext db = new FiveOursContext())
                {
                    var result = new Result()
                    {
                        PlayerName = _playerName,
                        GameTime   = _timerTime.Ticks,
                        MovesCount = _moves
                    };

                    db.Add(result);
                    db.SaveChanges();
                }
                LogHelper.Log(LogTarget.File, LogType.Info,
                              $"Game completed with saving results. Player name: {_playerName}");
            }

            ResultsWindow cw = new ResultsWindow();

            cw.ShowInTaskbar = false;
            cw.Owner         = Application.Current.MainWindow;
            cw.Show();

            _isClosingByEndingGame = true;
            Close();
        }
 private void ResultsBtnClick(object sender, RoutedEventArgs e)
 {
     try
     {
         ResultsWindow cw = new ResultsWindow();
         cw.ShowInTaskbar = false;
         cw.Owner         = Application.Current.MainWindow;
         this.Visibility  = Visibility.Hidden;
         cw.Show();
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, LogType.Fatal, ex.ToString());
     }
 }