Esempio n. 1
0
        /// <summary>Run APSIM.</summary>
        /// <param name="multiProcessRunner">Use the multi-process runner?</param>
        private void RunAPSIMInternal(bool multiProcessRunner)
        {
            if (this.explorerPresenter.Save())
            {
                List <string> duplicates = this.explorerPresenter.ApsimXFile.FindDuplicateSimulationNames();
                if (duplicates.Count > 0)
                {
                    string errorMessage = "Duplicate simulation names found " + StringUtilities.BuildString(duplicates.ToArray(), ", ");
                    explorerPresenter.MainPresenter.ShowError(errorMessage);
                }
                else
                {
                    Runner.RunTypeEnum typeOfRun = Runner.RunTypeEnum.MultiThreaded;
                    if (multiProcessRunner)
                    {
                        typeOfRun = Runner.RunTypeEnum.MultiProcess;
                    }

                    Model model  = Apsim.Get(this.explorerPresenter.ApsimXFile, this.explorerPresenter.CurrentNodePath) as Model;
                    var   runner = new Runner(model, runType: typeOfRun, wait: false);
                    this.command = new RunCommand(model.Name, runner, this.explorerPresenter);
                    this.command.Do(null);
                }
            }
        }
Esempio n. 2
0
        /// <summary>Run APSIM.</summary>
        /// <param name="multiProcessRunner">Use the multi-process runner?</param>
        private void RunAPSIMInternal(bool multiProcessRunner)
        {
            if (this.explorerPresenter.Save())
            {
                Runner.RunTypeEnum typeOfRun = Runner.RunTypeEnum.MultiThreaded;
                if (multiProcessRunner)
                {
                    typeOfRun = Runner.RunTypeEnum.MultiProcess;
                }

                Model model  = Apsim.Get(this.explorerPresenter.ApsimXFile, this.explorerPresenter.CurrentNodePath) as Model;
                var   runner = new Runner(model, runType: typeOfRun, wait: false);
                this.command = new RunCommand(model.Name, runner, this.explorerPresenter);
                this.command.Do(null);
            }
        }
Esempio n. 3
0
        /// <summary>Run APSIM.</summary>
        /// <param name="multiProcessRunner">Use the multi-process runner?</param>
        private void RunAPSIMInternal(bool multiProcessRunner)
        {
            if (!Configuration.Settings.AutoSave || this.explorerPresenter.Save())
            {
                Runner.RunTypeEnum typeOfRun = Runner.RunTypeEnum.MultiThreaded;
                if (multiProcessRunner)
                {
                    typeOfRun = Runner.RunTypeEnum.MultiProcess;
                }

                Model model  = this.explorerPresenter.ApsimXFile.FindByPath(this.explorerPresenter.CurrentNodePath)?.Value as Model;
                var   runner = new Runner(model, runType: typeOfRun, wait: false);
                this.command = new RunCommand(model.Name, runner, this.explorerPresenter);
                this.command.Do();
            }
        }