private void GenerateButtonClicked(object sender, RoutedEventArgs e)
        {
            Debug.WriteLine("Generate System Button Clicked");

            if (string.IsNullOrWhiteSpace(hexXCoordinateTextBox.Text) || string.IsNullOrWhiteSpace(hexYCoordinateTextBox.Text))
            { }
            if (string.IsNullOrWhiteSpace(planetaryGenerationRoll1TextBox.Text) || string.IsNullOrWhiteSpace(planetaryGenerationRoll2TextBox.Text))
                return;
            if (string.IsNullOrWhiteSpace(ftlRoll1TextBox.Text) && string.IsNullOrWhiteSpace(ftlRoll2TextBox.Text))
                return;

            Debug.WriteLine("All Fields Entered");

            HexCoordinate hexCoordinate = new HexCoordinate();
            if (!int.TryParse(hexXCoordinateTextBox.Text, out hexCoordinate.X))
                hexCoordinate.X = ViewModel.Die.Roll(100);
            if (!int.TryParse(hexYCoordinateTextBox.Text, out hexCoordinate.Y))
                hexCoordinate.Y = ViewModel.Die.Roll(100);

            Debug.WriteLine("Hex Coordinate Validated");

            int planetGenerationRoll1;
            int planetGenerationRoll2;
            if (!int.TryParse(planetaryGenerationRoll1TextBox.Text, out planetGenerationRoll1))
                return;
            if (!int.TryParse(planetaryGenerationRoll2TextBox.Text, out planetGenerationRoll2))
                return;

            Debug.WriteLine("Planetary Generation Rolls Validated");

            int ftlRoll1 = 0;
            int ftlRoll2 = 0;
            if (!int.TryParse(ftlRoll1TextBox.Text, out ftlRoll1)) { }
            if (!int.TryParse(ftlRoll2TextBox.Text, out ftlRoll2)) { }

            Debug.WriteLine("FTL Rolls Validated");

            try
            {
                ViewModel.GenerateSystem(hexCoordinate, planetGenerationRoll1, planetGenerationRoll2, ftlRoll1, ftlRoll2, ftlExplorerCheckbox.IsChecked.Value, forceSentientSpeciesCheckBox.IsChecked.Value, seedHexCheckBox.IsChecked.Value, seedPlanetaryGenerationCheckBox.IsChecked.Value, seedFTLCheckBox.IsChecked.Value);
            }
            catch (Exception) { }
        }
        public void GenerateSystem(HexCoordinate hexCoordinate, int planetaryGenerationRoll1, int planetaryGenerationRoll2, int ftlRoll1, int ftlRoll2, bool isExplorer, bool forceSentientSpecies, bool seedHex, bool seedPlanetaryGeneration, bool seedFTL)
        {
            Debug.WriteLine("Generating System : Hex:{0}, PG1:{1}, PG2:{2}, FTL1:{3}, FTL2:{4}, IsExplorer:{5}, SeedHex:{6}, SeedPG:{7}, SeedFTL:{8}", hexCoordinate, planetaryGenerationRoll1, planetaryGenerationRoll2, ftlRoll1, ftlRoll2, isExplorer, seedHex, seedPlanetaryGeneration, seedFTL);

            // First we will seed the dice so that the GM can pull up the system coordinates again with the same input values
            if (seedHex || seedPlanetaryGeneration || seedFTL)
            {
                int seed = 1;
                if (seedHex)
                {
                    seed = int.Parse(hexCoordinate.X + "" + hexCoordinate.Y);
                }
                if (seedPlanetaryGeneration)
                {
                    seed += planetaryGenerationRoll1;
                    seed += planetaryGenerationRoll2;
                }
                if (seedFTL)
                {
                    seed += ftlRoll1;
                    seed += ftlRoll2;
                }

                Die.ChangeSeed(seed);
                Debug.WriteLine("Seeded Dice");
            }
            else Die = new Dice();

            // Now that everything is setup, begin generating the system
            ObservableCollection<StarSystem> tempStarSystem = new ObservableCollection<StarSystem>();

            FTLTravelResult = FindFTLResult(isExplorer, ftlRoll1, ftlRoll2);
            int totalPlanetGeneration = planetaryGenerationRoll1 + planetaryGenerationRoll2;

            int starRoll = Die.Roll(100);
            int totalStars = 1;
            if (starRoll > 90)
                totalStars = Die.Roll(4);

            // Fill the system with random bodies
            Debug.WriteLine("Rolling Objects in System");
            for (int i = 0; i < totalStars; i++)
            {
                Debug.WriteLine("New Star");
                StarSystem star = new StarSystem();
                star.Radiation = ((RadiationLevel)Die.RollBetween(0, ((int)RadiationLevel.Extreme) + 1));
                star.Classification = ((StarClassification)Die.RollBetween(0, (int)StarClassification.Blackhole) + 1);
                star.Age = ((StarAge)Die.RollBetween(0, (int)StarAge.EndOfLife) + 1);

                int totalBodies = Die.Roll(6);
                for (int x = 0; x < totalBodies; x++)
                {
                    star.CelestialBodies.Add(GenerateCelestialBody(FTLTravel.NormalSystem));
                }

                tempStarSystem.Add(star);
            }

            // Roll the Main Generator
            Debug.WriteLine("Generating the Planet from Inputs");
            CelestialObject generatedPlanet = GenerateCelestialBody(FTLTravelResult, forceSentientSpecies);
            generatedPlanet.CelestialType = CelestialBodyType.TerrestrialPlanet;
            tempStarSystem[0].CelestialBodies.Add(generatedPlanet);

            // Finally, update the collection
            Debug.WriteLine("Finished Generating System");
            GeneratedSystem = tempStarSystem;
        }