public void HandlePreset(PresetDormConflicts thisDormDelegates) { IsPresetDorm = true; ActivitiesToClear.UnionWith(thisDormDelegates.UnavailableActivities); if (HasMultiDormOptions && thisDormDelegates.OtherDorm != -1) { AddDormForClearing(thisDormDelegates.OtherDorm); } }
public bool SelectDelegates() { DormsToClear.Remove(Dorm); if (ActivitiesToClear.Count > 0) { MainDelegates.Insert(0, o => ActivitiesToClear.Contains(o.Activity)); } if (DoDormDelegates) { if (DormsToClear.Count > 0) { //IncludedDorms.ExceptWith(DormsToClear); DormDelegates.Add(o => DormsToClear.Contains(o.OtherDorm)); } if (InterDormActivityConflicts.Count > 0) { DormDelegates.Add( o => InterDormActivityConflicts.TryGetValue( o.OtherDorm, out SortedSet <int> conflicts ) && conflicts.Contains(o.Activity) ); } if (DormDelegates.Count > 0) { if (MainDelegates.Count > 0) { MainDelegates.Insert( MainDelegates.Count - 1, o => o.HasOther && DormDelegates.Any(d => d(o)) ); } else { MainDelegates.Add(o => o.HasOther && DormDelegates.Any(d => d(o))); } } } return(MainDelegates.Count > 0); }