private async Task SetupDocumentAsync(Document document) { var root = await document.GetSyntaxRootAsync(); var walker = new Walker(); walker.Visit(root); var nodes = walker.CompilationUnitNode.Children.OfType <NamespaceNode>().SelectMany(c => c.Children) .Concat(walker.CompilationUnitNode.Children.Where(c => !typeof(NamespaceNode).IsAssignableFrom(c.GetType()))); foreach (var structureNode in nodes) { switch (structureNode) { case ClassNode classNode: if (!string.IsNullOrWhiteSpace(classNode.ClassIdentifier)) { var entityFigure = FindFigure(classNode); if (entityFigure == null) { entityFigure = new EntityFigure(); DiagramPanel.Children.Add(entityFigure); } entityFigure.ClassNode = classNode.Node; } break; default: break; } } ArrangeFigures(); }
private void DragStartEvent(object sender, RoutedEventArgs e) { EntityFigure ef = (EntityFigure)e.OriginalSource; DraggingFigure = ef; Panel.SetZIndex(ef, DiagramPanel.Children.Cast <UIElement>().Max(z => Panel.GetZIndex(z)) + 1); DragStartPosition = Mouse.GetPosition(ef); CaptureMouse(); }