Esempio n. 1
0
        /// <summary>Cleanup after the run.</summary>
        public void CleanupRun(string errorMessage)
        {
            _IsRunning = false;

            if (Completed != null)
            {
                Completed.Invoke(this, null);
            }

            Apsim.DisconnectEvents(this);
            Apsim.UnresolveLinks(this);
            foreach (Model child in Apsim.ChildrenRecursively(this))
            {
                Apsim.DisconnectEvents(child);
                Apsim.UnresolveLinks(child);
            }

            timer.Stop();
            if (errorMessage == null)
            {
                Console.WriteLine("Completed: " + Path.GetFileNameWithoutExtension(FileName) + " - " + Name + " [" + timer.Elapsed.TotalSeconds.ToString("#.00") + " sec]");
            }
            else
            {
                Console.WriteLine("Completed with errors: " + Path.GetFileNameWithoutExtension(FileName));
                Console.WriteLine(errorMessage);
            }
        }
Esempio n. 2
0
        /// <summary>Cleanup after the run.</summary>
        public void CleanupRun()
        {
            _IsRunning = false;

            if (Completed != null)
            {
                Completed.Invoke(this, null);
            }

            Apsim.DisconnectEvents(this);
            Apsim.UnresolveLinks(this);
            foreach (Model child in Apsim.ChildrenRecursively(this))
            {
                Apsim.DisconnectEvents(child);
                Apsim.UnresolveLinks(child);
            }

            timer.Stop();
            Console.WriteLine("File: " + Path.GetFileNameWithoutExtension(this.FileName) + ", Simulation " + this.Name + " complete. Time: " + timer.Elapsed.TotalSeconds.ToString("0.00 sec"));
        }