Пример #1
0
 // Attach and detach for Colleague registration
 public void Attach(MediatorColleague mc)
 {
     // Before we add, need to check to see if other MC's need updating.
     // This is a key part of the SnapViewDirector "mediator" role - to coordinate its Colleagues.
     updateExistingMC(mc);
     
     mcList.AddLast(mc);
 }
Пример #2
0
        public void Detach(MediatorColleague mc)
        {
            // Before we detach, need to update other MC's (e.g., a removed Constraint invalidates stat MC's)
            // This is a key part of the SnapViewDirector "mediator" role - to coordinate its Colleagues.
            updateExistingMC(mc);

            mcList.Remove(mc);
            // Need exception for trying to remove something that isn't there
        }
Пример #3
0
 // Update existing MC's depending on what is about to be attached
 void updateExistingMC(MediatorColleague mc_change)
 {
     // If this is a filter or constraint - every MC gets set to "inValid" (subject to local overrides)
     // [Note: I may well end up putting every MC type in here - in which case change it]
     if (mc_change is FilterMC || mc_change is ConstraintMC)
     {
         foreach (MediatorColleague mc_other in mcList)
         {
             mc_other.isValid = false;
         }
     }
 }