Ejemplo n.º 1
0
        private void MutateWithLockThenRaiseEvents([NotNull] Func <DiagramEvent> diagramMutatorFunc)
        {
            DiagramEvent diagramEvent;

            lock (_diagramUpdateLockObject)
            {
                diagramEvent  = diagramMutatorFunc.Invoke();
                LatestDiagram = diagramEvent.NewDiagram;
            }

            DiagramChanged?.Invoke(diagramEvent);
            _diagramChangedEventStream.OnNext(diagramEvent);
            AfterDiagramChanged?.Invoke(diagramEvent);
        }
Ejemplo n.º 2
0
        private void MutateWithLockThenRaiseEvents([NotNull] Action <IDiagramMutator> diagramMutatorFunc)
        {
            DiagramEvent diagramEvent;

            lock (_diagramUpdateLockObject)
            {
                var diagramMutator = CreateDiagramMutator();
                diagramMutatorFunc.Invoke(diagramMutator);
                diagramEvent  = diagramMutator.GetDiagramEvent();
                LatestDiagram = diagramEvent.NewDiagram;
            }

            if (diagramEvent.IsEmpty)
            {
                return;
            }

            DiagramChanged?.Invoke(diagramEvent);
            _diagramChangedEventStream.OnNext(diagramEvent);
            AfterDiagramChanged?.Invoke(diagramEvent);
        }