Exemple #1
0
            public IPeripheralsGroup GetOrCreate(string name, IEnumerable <IPeripheral> peripherals)
            {
                IPeripheralsGroup existingResult = null;
                var result = (PeripheralsGroup)existingResult;

                if (!TryGetByName(name, out existingResult))
                {
                    result = new PeripheralsGroup(name, machine);
                    groups.Add(result);
                }

                foreach (var p in peripherals)
                {
                    result.Add(p);
                }

                return(result);
            }
Exemple #2
0
 public bool TryGetByName(string name, out IPeripheralsGroup group)
 {
     group = ActiveGroups.SingleOrDefault(x => x.Name == name);
     return(group != null);
 }
Exemple #3
0
 public bool TryGetAnyGroupContaining(IPeripheral peripheral, out IPeripheralsGroup group)
 {
     group = groups.SingleOrDefault(x => x.Contains(peripheral));
     return(group != null);
 }