public void Execute(CreateNodeCommand command)
        {
            var node       = Activator.CreateInstance(command.NodeType) as IDiagramNode;
            var repository = Container.Resolve <IRepository>();

            node.GraphId = command.GraphData.Identifier;
            repository.Add(node);
            if (string.IsNullOrEmpty(node.Name))
            {
                node.Name =
                    repository.GetUniqueName("New" + node.GetType().Name.Replace("Data", ""));
            }

            var filterItem = node as IFilterItem;

            if (filterItem != null)
            {
                filterItem.FilterId = command.GraphData.CurrentFilter.Identifier;
                filterItem.Position = command.Position;
            }
            else
            {
                command.GraphData.CurrentFilter.ShowInFilter(node, command.Position);
            }

            // Start name editing
            DiagramNodeViewModel diagramNodeViewModel = InvertGraphEditor.CurrentDiagramViewModel.GraphItems
                                                        .OfType <DiagramNodeViewModel>()
                                                        .First(nodeViewModel => nodeViewModel.DataObject == node);

            InvertApplication.Execute(new RenameCommand {
                ViewModel = diagramNodeViewModel
            });
        }
        public bool KeyDown(bool control, bool alt, bool shift, KeyCode character)
        {
            if (character == KeyCode.F2)
            {
                GraphItemViewModel selectNodeItem = InvertGraphEditor.CurrentDiagramViewModel.SelectedNodeItem;
                if (selectNodeItem != null)
                {
                    DiagramNodeItem nodeItem = selectNodeItem.DataObject as DiagramNodeItem;
                    if (nodeItem != null)
                    {
                        nodeItem.IsEditing = true;
                        return(false);
                    }
                }

                DiagramNodeViewModel selectedNode = InvertGraphEditor.CurrentDiagramViewModel.SelectedNode;
                if (selectedNode != null)
                {
                    InvertApplication.Execute(new RenameCommand()
                    {
                        ViewModel = selectedNode
                    });
                    return(false);
                }
            }
            if (character == KeyCode.Delete)
            {
                DiagramNodeViewModel selectedNode = InvertGraphEditor.CurrentDiagramViewModel.SelectedNode;
                if (selectedNode != null)
                {
                    InvertApplication.Execute(new DeleteCommand()
                    {
                        Item = new[] { selectedNode.DataObject as IDataRecord }
                    });
                    return(false);
                }
            }
            return(false);
        }
Exemple #3
0
        public ActionResult Index()
        {
            var groepen = GetGroepen();

            List <DiagramNodeViewModel> model = new List <DiagramNodeViewModel>();

            foreach (var groep in groepen)
            {
                DiagramNodeViewModel node = new DiagramNodeViewModel
                {
                    Id       = groep.Id.ToString(),
                    IdParent = groep.IdParent.ToString(),
                    Naam     = groep.Naam,
                    Kleur    = "orange"
                };

                model.Add(node);

                foreach (var gebruiker in groep.Gebruikers)
                {
                    DiagramNodeViewModel node2 = new DiagramNodeViewModel
                    {
                        Id       = gebruiker.Id.ToString(),
                        IdParent = groep.Id.ToString(),
                        Naam     = gebruiker.Naam,
                        Kleur    = "blue"
                    };


                    model.Add(node2);
                }
            }


            return(View(model));
        }
 public ViewModel(TData graphItemObject, DiagramNodeViewModel diagramViewModel)
     : base(graphItemObject, diagramViewModel)
 {
 }
   public PropertyFieldViewModel(DiagramNodeViewModel nodeViewModel) : base(nodeViewModel)
   {
 
   }
 public GenericChildItemHeaderDrawer(DiagramNodeViewModel viewModelObject)
     : base(viewModelObject)
 {
 }