Пример #1
0
        /// <summary>
        /// Creates a ProgramSet with one program instance
        /// </summary>
        public ProgramSet CreateSingularProgramSet(string programSetName, ZoneProgram program, ISV isv, Zone zone, dynamic startingParameters = null)
        {
            if (!AvailableZones.Contains(zone))
            {
                throw new Exception("The provided zone is not available.");
            }

            var programSet = new ProgramSet(program, zone, isv, programSetName, startingParameters);

            ProgramSets.Add(programSet);
            return(programSet);
        }
Пример #2
0
        /// <summary>
        /// Creates a ProgramSet
        /// </summary>
        /// <param name="programSetName">Name of program set</param>
        /// <param name="programName">Name of program</param>
        /// <param name="sync">Whether or not to start the programs in sync</param>
        /// <param name="isv">Input starting values - starting values for the inputs</param>
        /// <param name="zones">Zones to run the program set on</param>
        /// <param name="startingParameters">Starting parameters for creating this program set. These will be fed to the constructor(s) of the ZoneProgram(s).</param>
        public ProgramSet CreateProgramSet(string programSetName, string programName, bool sync, ISV isv,
                                           IEnumerable <Zone> zones, dynamic startingParameters = null)
        {
            var zonesList = zones as IList <Zone> ?? zones.ToList();

            if (zonesList.Any(z => !AvailableZones.Contains(z)))
            {
                throw new Exception("Some of the provided zones are not available.");
            }

            var programSet = new ProgramSet(programName, zonesList, sync, isv.Listify(), programSetName, startingParameters);

            ProgramSets.Add(programSet);
            return(programSet);
        }
Пример #3
0
 /// <summary>
 /// Disposes the given program set(s). If no specific program sets are provided, disposes all program sets.
 /// </summary>
 public void DisposeProgramSets(List <string> programSetNames = null, bool force = false)
 {
     if (programSetNames == null || !programSetNames.Any())
     {
         ProgramSets?.ForEach(programSet => programSet?.Dispose(force));
         ProgramSets?.Clear();
     }
     else
     {
         var programSetsToDispose = ProgramSets?.Where(programSet => programSetNames.Contains(programSet.Name)).ToList();
         programSetsToDispose?.ForEach(programSet =>
         {
             ProgramSets?.Remove(programSet);
             programSet?.Dispose(force);
         });
     }
 }