private void Window_Closing(object sender, CancelEventArgs e)
 {
     dashboard.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(dashboard.Close));
     Owner.Show();
     Owner.Topmost = true;
     game          = null;
     player        = null;
     dashboard     = null;
 }
        public void LoadGame(GameOptions gameOptions)
        {
            game   = new Common.Game(gameOptions.Size);
            player = new Player()
            {
                Position = new Position()
                {
                    Row    = 0,
                    Column = 0
                },
                maxRow    = 0,
                maxColumn = 0
            };
            game.Map[player.Position.Row, player.Position.Column] = player;

            //Add objects to map
            var goldCoordinates = gameOptions.Gold.Split(',');

            game.AddGold(int.Parse(goldCoordinates[0]), int.Parse(goldCoordinates[1]));

            try
            {
                Parallel.Invoke(
                    () =>
                {
                    foreach (var item in gameOptions.Pits)
                    {
                        var pitCoordinates = item.Split(',');
                        game.AddPit(int.Parse(pitCoordinates[0]), int.Parse(pitCoordinates[1]));
                    }
                },
                    () =>
                {
                    foreach (var item in gameOptions.Beacons)
                    {
                        var beaconCoordinates = item.Split(',', '=');
                        game.AddBeacon(int.Parse(beaconCoordinates[0]), int.Parse(beaconCoordinates[1]), int.Parse(beaconCoordinates[2]));
                    }
                }
                    );
            }
            catch (Exception)
            {
                throw;
            }


            Thread newWindowThread = new Thread(new ThreadStart(ThreadStartingPoint));

            newWindowThread.SetApartmentState(ApartmentState.STA);
            newWindowThread.IsBackground = true;
            newWindowThread.Start();


            RefreshGrid();
        }