I try to modify the model programmatically but I have some problems. 2 to be exact. What I trying to do is when a Deaerator (a node) is dropped in the diagram, programmatically I create a Boiler and link this boiler to the Deaerator at the appropriate ports.
The link doesn’t start or end from/to a port (see the picture below and the code to link these 2 nodes).
I don’t know why, but 2 Boilers seem to be added to the Model.NodeSource…
What I’m doing wrong?
private void HandleFlowSheetModelChanged(object sender, Northwoods.GoXam.Model.ModelChangedEventArgs e)
<span =“Apple-tab-span” style=“white-space:pre”> //…
FlowSheetModel.StartTransaction("Create new Boiler"); //Create the new Boiler IBoiler boiler = ViewModelFactory.CreateInstance(typeof(IBoiler), _DialogService) as IBoiler; //Add the new Boiler to the model FlowSheetModel.AddNode(boiler); //Add the link between the Deaerator and the Boiler FlowSheetModel.AddLink(deaerator,deaerator.OutVent.ToString(),boiler, boiler.InAir.ToString()); FlowSheetModel.CommitTransaction("Create new Boiler"); }