Improving the Performance of the Diagram while Selecting and Moving the lots of Nodes
Improving the Performance of the Diagram
While performing interaction in the diagram containing lots of nodes (for example: 100 Nodes and 100 Connectors) there will be a dispute in its performance. To overcome the dispute we need to Pause and Resume some of the services which utilizes maximum resources which will be a reason for the performance dispute.
We have listed the services which results maximum resource utilization:
- LinkManager,
- HistoryManager,
- BridgeManager and
- EventSink.
LinkManager:
LinkManager holds the information about the connected Nodes in the diagram.
HistoryManager:
HistoryManager holds the history of the diagram like adding a node and deleting a node.
BridgeManager:
BridgeManager holds the information’s about bridging which is enabled when two connectors intersects each other.
EventSink:
EventSink holds information about the events which are registered in the control.
Pause the Service:
The below code snippet is used to pause the service.
[C#]
//Pause the services void m_diagram_MouseDown(object sender, MouseEventArgs e) { this.m_diagram.Model.LinkManager.Pause(); this.m_diagram.EventSink.Pause(); this.m_diagram.Model.EventSink.Pause(); this.m_diagram.Model.BridgeManager.Pause(); this.m_diagram.Model.HistoryManager.Pause(); }
[VB] Private Sub m_diagram_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Me.m_diagram.Model.LinkManager.Pause() Me.m_diagram.EventSink.Pause() Me.m_diagram.Model.EventSink.Pause() Me.m_diagram.Model.BridgeManager.Pause() Me.m_diagram.Model.HistoryManager.Pause() End Sub
Resuming the Service:
The below code snippet is used for resuming the service.
[C#] //Resuming the services void m_diagram_MouseUp(object sender, MouseEventArgs e) { this.m_diagram.Model.LinkManager.Resume(); this.m_diagram.Model.HistoryManager.Resume(); this.m_diagram.Model.BridgeManager.Resume(); this.m_diagram.Model.EventSink.Resume(); this.m_diagram.EventSink.Resume(); }
[VB] 'Resuming the services Private Sub m_diagram_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Me.m_diagram.Model.LinkManager.Resume() Me.m_diagram.Model.HistoryManager.Resume() Me.m_diagram.Model.BridgeManager.Resume() Me.m_diagram.Model.EventSink.Resume() Me.m_diagram.EventSink.Resume() End Sub