/// <summary> /// Called whenever a relationship of type DiagramClassViewHasRootDiagramNodes is deleted and /// the element hosted by this model is the source. /// </summary> /// <param name="args"></param> private void OnRootDiagramNodeRemoved(ElementDeletedEventArgs args) { DiagramClassViewHasRootDiagramNodes con = args.ModelElement as DiagramClassViewHasRootDiagramNodes; if (con != null) { DeleteRootDiagramNode(con.RootDiagramNode); } }
/// <summary> /// Called whenever a relationship of type DiagramClassViewHasRootDiagramNodes is added and /// the element hosted by this model is the source. /// </summary> /// <param name="args"></param> private void OnRootDiagramNodeAdded(ElementAddedEventArgs args) { DiagramClassViewHasRootDiagramNodes con = args.ModelElement as DiagramClassViewHasRootDiagramNodes; if (con != null) { AddRootDiagramNode(con.RootDiagramNode); } }
/// <summary> /// Called on a role player changing. /// </summary> /// <param name="args"></param> private void OnRootDiagramNodeChanged(RolePlayerChangedEventArgs args) { DiagramClassViewHasRootDiagramNodes con = args.ElementLink as DiagramClassViewHasRootDiagramNodes; if (con != null) { if (args.DomainRole.Id == DiagramClassViewHasRootDiagramNodes.DiagramClassViewDomainRoleId) { if (args.OldRolePlayerId == this.DiagramClassView.Id) { DeleteRootDiagramNode(con.RootDiagramNode); } if (args.NewRolePlayerId == this.DiagramClassView.Id) { AddRootDiagramNode(con.RootDiagramNode); } } } }