Profile Picture

Document EventSinkServices after loading a diagram

Posted By Wilhelm Vortisch 14 Years Ago
Author
Message
Wilhelm Vortisch
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
Hi Volvick,

thank you for the reply, my solution meanwhile:
If I use the predefined function of "New", "Open" and so in the NDiagramCommandBarsManager I have implemented a EventSinkService for the event DisplayedDocumentChanged of the NDrawingView.
Example:
nDrawingView1.EventSinkService.DisplayedDocumentChanged += new
Nevron.Diagram.DocumentEventHandler(EventSinkService_DisplayedDocumentChanged);

And the implementation:
private void EventSinkService_DisplayedDocumentChanged(NDocumentEventArgs args)
{
nDrawingDocument1 = nDrawingView1.Document;
nDrawingDocument1.BeginUpdate();
nDrawingDocument1.EventSinkService.NodeInserted += new ChildNodeEventHandler(EventSinkService_NodeInserted);
nDrawingDocument1.EventSinkService.NodeRemoving += new ChildNodeCancelEventHandler(EventSinkService_NodeRemoving);
nDrawingDocument1.EventSinkService.NodeDoubleClick += new NodeViewEventHandler(EventSinkService_NodeDoubleClicked);
nDrawingDocument1.EndUpdate();

}

The result of this implemenation is: after a "New" or "Open" of a document the EventSinkServices of the document are "reinstalled".

Regards

Wilhelm

Volvick Derose
Posted 14 Years Ago
View Quick Profile
Forum Guru

Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)Forum Guru (71 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 71, Visits: 1
Hey, to solve this problem you need to add the event sink to the load diagram button as well. For instance, if you click on a button to load the diagram, then inside the onclick event of that button you need to include that code as well

nDrawingDocument1.EventSinkService.NodeDoubleClick += new NodeViewEventHandler(EventSinkService_NodeDoubleClicked);

that will fix the problem. I had the same problem, and that fixed it

Wilhelm Vortisch
questionmark Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
Hi,

I have a problem with document EventSinkServices after loading a diagram with the "open" command of NDiagramCommandBarsManager.
In my application I have added the following command in the Form_Load function for getting the double click event:

nDrawingDocument1.EventSinkService.NodeDoubleClick += new NodeViewEventHandler(EventSinkService_NodeDoubleClicked);

If I add a shape to the default drawing document, it's all OK.
After I save these diagram to a ndb file and reloads it over the standard NDiagramCommandBarsManager command ("the open icon"), all EventSinkServices releated to the drawing document are "not active".

Where can I enable these EventSinkServices for a new drawing document?

Regards

Wilhelm




Similar Topics


Reading This Topic