public void ProcessConnectEntitiesOnDiagram(DiagramEntityDTO from, DiagramEntityDTO to) { if (from == null) { throw new ArgumentNullException("from"); } if (to == null) { throw new ArgumentNullException("to"); } var newRelation = new RelationDTO() { RelationName = String.Format("{0}_{1}", from.EntityName, to.EntityName), PrimaryEntityID = to.EntityID, ForeignEntityID = from.EntityID }; var view = new RelationDetailsView(); view.Object = newRelation; var popup = new PopupWindow(); popup.Title = "New Relation"; popup.Validate = () => { return(new Validator().Validate(newRelation)); }; popup.ViewPanel.Children.Add(view); if (popup.ShowDialog() == true) { new ObjectDataSource().SaveObject(newRelation); } ServiceLocator serviceLocator = ServiceLocator.GetActive(); serviceLocator.BasicController.ProcessProjectTreeRefresh(); }
public void ProcessAddNewEntityOnDiagram(DiagramDTO diagram, Point point) { if (diagram == null) { throw new InvalidOperationException("No diagram selected."); } var newEntity = ProcessCreateNewEntity(); if (newEntity != null) { var newDiagramEntity = new DiagramEntityDTO() { DiagramID = diagram.ID, EntityID = newEntity.ID, X = (int)point.X, Y = (int)point.Y }; new ObjectDataSource().SaveObject(newDiagramEntity); } ServiceLocator serviceLocator = ServiceLocator.GetActive(); serviceLocator.BasicController.ProcessProjectTreeRefresh(); }