private void StartButton_Click(object sender, EventArgs e)
        {
            StartButton.Enabled = false;
            NumGen.Enabled = false;
            label1.Enabled = false;

            MaxGen = Convert.ToInt32(NumGen.Value);
            PBar.Maximum = MaxGen;
            BufferedSimulation Sim = new BufferedSimulation(MaxGen);

            //For each generation
            for (CurrentGen = 0; CurrentGen < MaxGen; CurrentGen++)
            {
                //Perform the calculation on that generation
                ParticleList = Simulation.Threaded_UpdateList(ParticleList, Precision, SofteningValue, GravityConstant, MaxVelocity);

                //Update the number of calculations
                TotalCalculations += ParticleList.Count * ParticleList.Count * 2;
                Status.Clear();
                Status.AppendText("Performed " + TotalCalculations.ToString("n0") + " Calculations...");

                Thread.Sleep(0);

                //Check for collisions!
                if (Collisions == true)
                {
                    ParticleList = Simulation.CheckCollisions(ParticleList, Precision, CollisionsDivider, CollisionType);

                    //Update the number of calculations
                    TotalCalculations += ParticleList.Count * ParticleList.Count * 2;
                    Status.Clear();
                    Status.AppendText("Performed " + TotalCalculations.ToString("n0") + " Calculations...");
                }

                //Check for boundaries!
                ParticleList = Simulation.CheckBoundaries(ParticleList, BoundaryType, UniverseSize);

                //Update the title
                double Percent = ((double)CurrentGen / (double)MaxGen) * 100;
                this.Text = "Buffering (" + Percent.ToString("n2") + "% Complete)...";

                //Add the set to the generation count
                Sim.AddGeneration(ParticleList);

                PBar.Value++;
                Thread.Sleep(0);
            }

            BufferedViewer x = new BufferedViewer(Sim);
            x.Show();
            this.Close();
        }
        private void LoadSim()
        {
            //Open the file and create a new binary formatter
            UpdateStatus("Accessing " + this.FilePath + "...");
            PBar.Style = ProgressBarStyle.Marquee;
            Stream stream = File.Open(this.FilePath, FileMode.Open);
            BinaryFormatter bFormatter = new BinaryFormatter();

            //Deserialize the number of generations
            int NumGenerations = (int)bFormatter.Deserialize(stream);
            WorkingSim = new BufferedSimulation(NumGenerations);
            List<List<List<double>>> ReadData = new List<List<List<double>>>(NumGenerations);

            //Prepare the progress bar
            PBar.Style = ProgressBarStyle.Blocks;
            PBar.Maximum = NumGenerations;
            PBar.Minimum = 0;

            //Read the data
            for (int i = 0; i < NumGenerations; i++)
            {
                UpdateStatus("Loading generation " + i + " of " + NumGenerations + "...");
                ReadData.Add((List<List<double>>)bFormatter.Deserialize(stream));
                PBar.Value++;
                double percent = ((double)i / (double)NumGenerations) * 100;
                this.Text = "Opening Buffered Simulation (" + percent.ToString("n2") + "% Complete)...";
            }

            //Set the working sim
            WorkingSim.Data = ReadData;

            //Close the stream
            stream.Close();

            //Open the Buffered Viewer
            Thread.Sleep(100);
            BufferedViewer x = new BufferedViewer(WorkingSim);
            x.Show();
            this.Close();
        }