Exemple #1
0
 /// <summary>
 /// Clears the cached scoping values for the simulation 
 /// We need to do this when models have been added or deleted,
 /// as the cache will then be incorrect
 /// </summary>
 /// <param name="model"></param>
 public static void ClearCaches(IModel model)
 {
     Simulation simulation = model as Simulation ?? model.FindAncestor<Simulation>();
     if (simulation != null && simulation.Scope != null)
     {
         simulation.ClearCaches();
     }
     else
     {
         // If the model didn't have a Simulation object as an ancestor, then it's likely to 
         // have a Simulations object as one. If so, the Simulations links may need to be updated.
         Simulations simulations = model.FindAncestor<Simulations>();
         if (simulations != null)
         {
             simulations.ClearLinks();
         }
     }
 }