/// <summary> /// Recursively subscribes to path changes. /// </summary> /// <param name="steps"></param> static void Subscribe(ModelStepList steps) { foreach (var step in steps) { step.Property.Observers.Add(step); Subscribe(step.NextSteps); } }
/// <summary> /// Recursively unsubscribes to path changes. /// </summary> /// <param name="steps"></param> static void Unsubscribe(ModelStepList steps) { foreach (var step in steps) { step.Property.Observers.Remove(step); Unsubscribe(step.NextSteps); } }
/// <summary> /// Recursively loads a path in the model by walking steps. /// </summary> /// <param name="instance"></param> /// <param name="step"></param> /// <param name="model"></param> void GetInstances(ModelInstance instance, ModelStepList steps, HashSet <ModelInstance> model) { // Add the instance to the model model.Add(instance); // Process each child step foreach (var step in steps) { // Process each instance foreach (var child in step.GetInstances(instance)) { GetInstances(child, step.NextSteps, model); } } }