private void AddEmptyGroup() { _diagram.AddGroup(new GroupModel(Array.Empty <NodeModel>()) { Position = new Point(100, 100) }); }
public void Behavior_ShouldTakeIntoAccountGroupConstraint() { // Arrange var funcCalled = false; var diagram = new Diagram(); diagram.Options.Constraints.ShouldDeleteGroup = _ => { funcCalled = true; return(false); }; diagram.AddGroup(new GroupModel(Array.Empty <NodeModel>()) { Selected = true }); // Act diagram.OnKeyDown(new KeyboardEventArgs { AltKey = false, CtrlKey = false, ShiftKey = false, Code = "Delete", }); // Assert funcCalled.Should().BeTrue(); diagram.Groups.Count.Should().Be(1); }
protected override void OnInitialized() { base.OnInitialized(); LayoutData.Title = "Custom group"; LayoutData.Info = "Creating your own custom groups is very easy!"; LayoutData.DataChanged(); _diagram.RegisterModelComponent <CustomGroupModel, CustomGroupWidget>(); var node1 = NewNode(50, 50); var node2 = NewNode(300, 300); var node3 = NewNode(500, 100); _diagram.Nodes.Add(new[] { node1, node2, node3 }); _diagram.AddGroup(new CustomGroupModel(new[] { node2, node3 }, "Group 1")); _diagram.Links.Add(new LinkModel(node1.GetPort(PortAlignment.Right), node2.GetPort(PortAlignment.Left))); _diagram.Links.Add(new LinkModel(node2.GetPort(PortAlignment.Right), node3.GetPort(PortAlignment.Left))); }