public Group(Room aRoom, Layer1.IGroup aGroup) { iRoom = aRoom; iGroup = aGroup; iSourceList = new List <Source>(); iMasterGroup = this; if (iGroup.Preamp != null) { iPreamp = new Preamp(this, iGroup.Preamp); iMasterPreamp = iPreamp; } else { iMasterPreamp = null; } InitialiseSources(); iGroup.EventSourceChanged += SourceChanged; iGroup.EventCurrentSourceChanged += CurrentSourceChanged; iGroup.EventStandbyChanged += StandbyChanged; }
internal bool Remove(Layer1.IGroup aGroup) { foreach (Group group in iGroupList) { if (group.Represents(aGroup)) { Source parent = group.Parent; if (parent != null) { if (iCurrent != null) { if (iCurrent.Group == group) { SetCurrentSourceAndPreamp(parent); } } parent.DeregisterChild(group); } else { if (iCurrent != null) { if (iCurrent.Group == group) { SetCurrentSourceAndPreamp(null); } } } Lock(); iGroupList.Remove(group); Unlock(); group.Kill(); group.EventStandbyChanged -= StandbyChanged; return(iGroupList.Count == 0); } } return(false); }
internal void Add(Layer1.IGroup aGroup) { Group group = new Group(this, aGroup); if (iGroupList.Count > 0) { HookUpParent(group); } else { SetCurrentSourceAndPreamp(group.CurrentSource); } Lock(); iGroupList.Add(group); Unlock(); group.EventStandbyChanged += StandbyChanged; }
public bool Represents(Layer1.IGroup aGroup) { return(iGroup == aGroup); }