Exemple #1
0
        private void backgroundGrid_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            // Pause the running simulation
            if (simRunning)
            {
                timer.Cancel();
            }

            sim.renderer.SetSimulationTransform(backgroundCanvas.ActualWidth, backgroundCanvas.ActualHeight);
            // var res = DisplayProperties.ResolutionScale;  // don't need this (yet)
            sim.TransformChanged();

            // TBD: restart the running simulation
            if (simRunning)
            {
                timer = ThreadPoolTimer.CreatePeriodicTimer(RunSimTick, new TimeSpan(0, 0, 0, 0, 1000 / (int)ticksPerSecond));
            }

            // TBD: Figure out which event to hook to initialize the initially loaded scenario (or maybe we have to do it this way since we need the initial layout to occur before loading the
            //          starting scenario)
            if (firstRun)
            {
                firstRun = false;
                ScenarioChanging();
                BuiltInScenarios.LoadNineBodiesScenario(sim);
            }
        }
Exemple #2
0
 private void Button_Click_Scenario4(object sender, RoutedEventArgs e)
 {
     ScenarioChanging();
     // BuiltInScenarios.LoadFiveBodiesScenario(sim);
     BuiltInScenarios.LoadThreeHundredRandomBodies(sim);
 }
Exemple #3
0
 private void Button_Click_Scenario2(object sender, RoutedEventArgs e)
 {
     ScenarioChanging();
     BuiltInScenarios.LoadNineBodiesScenario(sim);
 }