Esempio n. 1
0
        /// <summary>
        /// Looks through the simulation for resource ledgers and adds
        /// them as options to the ledger box
        /// </summary>
        /// <param name="table">The table model in the simulation</param>
        public void SetLedgers(PivotTable table)
        {
            // Find a CLEMFolder
            CLEMFolder folder = new CLEMFolder();

            folder = Apsim.Find(table, typeof(CLEMFolder)) as CLEMFolder;

            // Look for ledgers inside the CLEMFolder
            foreach (var child in folder.Children)
            {
                if (child.GetType() != typeof(ReportResourceLedger))
                {
                    continue;
                }

                ReportResourceLedger ledger = child as ReportResourceLedger;
                Ledger.AddText(ledger.Name);
            }

            // Set the active ledger option
            if (Ledger.ID < 0)
            {
                Ledger.ID = 0;
            }
        }