Example #1
0
        private void StopActiveInteractionsThatShouldStop(DiagramInteractionEventArguments interaction)
        {
            var activeInteractors = ActiveDiagramInteractors.ToArray();

            foreach (var activeInteractor in activeInteractors)
            {
                TryStoppingInteraction(interaction, activeInteractor);
            }
        }
Example #2
0
        private void SendInteractionToActiveInteractions(DiagramInteractionEventArguments interaction)
        {
            var activeInteractors = ActiveDiagramInteractors.ToArray();

            foreach (var activeInteractor in activeInteractors)
            {
                activeInteractor.ProcessInteraction(interaction);
            }
        }
Example #3
0
 private void SendInteractionToInteractors(DiagramInteractionEventArguments interaction)
 {
     if (!ActiveDiagramInteractors.Any())
     {
         StartAndProcessInteractionsThatShouldStart(interaction);
     }
     else
     {
         SendInteractionToActiveInteractions(interaction);
         StopActiveInteractionsThatShouldStop(interaction);
     }
 }
Example #4
0
        private bool TryStoppingInteraction(DiagramInteractionEventArguments interaction, DiagramInteractor activeInteractor)
        {
            var didInteractionStop = activeInteractor.ShouldStopInteraction(interaction);

            if (didInteractionStop)
            {
                activeInteractor.StopInteraction(interaction);
                ActiveDiagramInteractors.Remove(activeInteractor);
                ActiveDiagramInteractorNames.Remove(activeInteractor.GetType().Name);
            }
            return(didInteractionStop);
        }
Example #5
0
 private void StartAndProcessInteractionsThatShouldStart(DiagramInteractionEventArguments interaction)
 {
     foreach (var interactor in WeightedDiagramInteractors)
     {
         if (interactor.ShouldStartInteraction(interaction))
         {
             interactor.StartInteraction(interaction);
             ActiveDiagramInteractors.Add(interactor);
             ActiveDiagramInteractorNames.Add(interactor.GetType().Name);
             interactor.ProcessInteraction(interaction);
             if (!TryStoppingInteraction(interaction, interactor))
             {
                 break;
             }
         }
     }
 }