Exemple #1
0
 /// <summary>
 /// User has clicked RunAPSIM
 /// </summary>
 private void OnRunApsimClick(object sender, EventArgs e)
 {
     try
     {
         Simulation          simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
         Commands.RunCommand run        = new Commands.RunCommand(Apsim.Parent(Experiment, typeof(Simulations)) as Simulations,
                                                                  simulation,
                                                                  ExplorerPresenter);
         run.Do(null);
     }
     catch (Exception err)
     {
         ExplorerPresenter.ShowMessage(err.Message, Models.DataStore.ErrorLevel.Error);
     }
 }
Exemple #2
0
 /// <summary>
 /// User has clicked RunAPSIM
 /// </summary>
 private void OnRunApsimClick(object sender, EventArgs e)
 {
     try
     {
         Simulation simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
         Commands.RunCommand run = new Commands.RunCommand(Apsim.Parent(Experiment, typeof(Simulations)) as Simulations,
                                                           simulation,
                                                           ExplorerPresenter);
         run.Do(null);
     }
     catch (Exception err)
     {
         ExplorerPresenter.MainPresenter.ShowMessage(err.Message, Models.DataStore.ErrorLevel.Error);
     }
 }
Exemple #3
0
 /// <summary>
 /// User has clicked RunAPSIM
 /// </summary>
 private void OnRunApsimClick(object sender, EventArgs e)
 {
     try
     {
         Simulation          simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
         Commands.RunCommand run        = new Commands.RunCommand(simulation,
                                                                  ExplorerPresenter,
                                                                  false,
                                                                  storageWriter);
         run.Do(null);
     }
     catch (Exception err)
     {
         ExplorerPresenter.MainPresenter.ShowMessage(err.Message, Simulation.ErrorLevel.Error);
     }
 }
Exemple #4
0
        /// <summary>
        /// User has clicked RunAPSIM
        /// </summary>
        private void OnRunApsimClick(object sender, EventArgs e)
        {
            try
            {
                Simulation           simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
                JobManager.IRunnable job        = Runner.ForSimulations(ExplorerPresenter.ApsimXFile, simulation, false);

                Commands.RunCommand run = new Commands.RunCommand(job,
                                                                  simulation.Name,
                                                                  ExplorerPresenter,
                                                                  false);
                run.Do(null);
            }
            catch (Exception err)
            {
                ExplorerPresenter.MainPresenter.ShowMessage(err.Message, Models.DataStore.ErrorLevel.Error);
            }
        }
Exemple #5
0
        /// <summary>
        /// User has clicked RunAPSIM
        /// </summary>
        private void OnRunApsimClick(object sender, EventArgs e)
        {
            try
            {
                List<JobManager.IRunnable> jobs = new List<JobManager.IRunnable>();
                Simulation simulation = Experiment.CreateSpecificSimulation(ListView.MemoLines[ListView.CurrentPosition.Y]);
                jobs.Add(simulation);
                jobs.Add(new RunAllCompletedEvent(ExplorerPresenter.ApsimXFile));

                Commands.RunCommand run = new Commands.RunCommand(jobs,
                                                                  simulation.Name,
                                                                  ExplorerPresenter);
                run.Do(null);
            }
            catch (Exception err)
            {
                ExplorerPresenter.MainPresenter.ShowMessage(err.Message, Models.DataStore.ErrorLevel.Error);
            }
        }
Exemple #6
0
        /// <summary>
        /// Runs a list of simulations.
        /// </summary>
        /// <param name="names">Names of the simulations to be run.</param>
        public void RunSims(List <string> names)
        {
            try
            {
                Simulation   sim;
                List <Model> simulationList = new List <Model>();
                foreach (string simName in names)
                {
                    sim = model.CreateSpecificSimulation(simName);
                    simulationList.Add(sim);
                }
                Simulations simulationsToRun = Simulations.Create(simulationList);

                Commands.RunCommand command = new Commands.RunCommand(simulationsToRun, explorerPresenter, false, null);
                command.Do(null);
            }
            catch (Exception e)
            {
                explorerPresenter.MainPresenter.ShowError(e);
            }
        }