예제 #1
0
 /// <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);
     }
 }
예제 #2
0
 /// <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);
     }
 }
예제 #3
0
        /// <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);
                }
            }
        }