Пример #1
0
        public static void Perform()
        {
            var doc = Document.Current;

            if (doc.Container == doc.RootNode)
            {
                var path = doc.SceneNavigatedFrom;
                if (path != null)
                {
                    var document = Project.Current.Documents.FirstOrDefault(i => i.Path == path);
                    if (document == null)
                    {
                        document = Project.Current.OpenDocument(path);
                    }
                    document.MakeCurrent();
                }
            }
            else
            {
                var container = doc.Container;
                SetProperty.Perform(container, nameof(Node.TangerineFlags), container.TangerineFlags & ~TangerineFlags.DisplayContent, isChangingDocument: false);
                EnterNode.Perform(container.Parent, false);
                SelectNode.Perform(container, true);
            }
        }
Пример #2
0
        private static void ChangeContainer(Node container, bool selectFirstNode)
        {
            ClearRowSelection.Perform();
            var prevContainer = Document.Current.Container;

            DocumentHistory.Current.Perform(new SetContainer(container));
            if (selectFirstNode && container.Nodes.Count > 0)
            {
                SelectNode.Perform(container.Nodes[0]);
            }
        }
Пример #3
0
        public static void Perform()
        {
            var doc = Document.Current;

            doc.Container.SetTangerineFlag(TangerineFlags.DisplayContent, false);
            if (doc.Container == doc.RootNode)
            {
                var path = doc.SceneNavigatedFrom;
                if (path != null)
                {
                    Project.Current.Documents.FirstOrDefault(i => i.Path == path)?.MakeCurrent();
                }
            }
            else
            {
                var container = doc.Container;
                EnterNode.Perform(doc.Container.Parent, false);
                SelectNode.Perform(container, true);
            }
        }
Пример #4
0
        public static Node Perform(Node container, FolderItemLocation location, Type nodeType)
        {
            if (!nodeType.IsSubclassOf(typeof(Node)))
            {
                throw new InvalidOperationException();
            }
            var ctr   = nodeType.GetConstructor(Type.EmptyTypes);
            var node  = (Node)ctr.Invoke(new object[] { });
            var attrs = ClassAttributes <TangerineNodeBuilderAttribute> .Get(nodeType);

            if (attrs?.MethodName != null)
            {
                var builder = nodeType.GetMethod(attrs.MethodName, BindingFlags.NonPublic | BindingFlags.Instance);
                builder.Invoke(node, new object[] { });
            }
            node.Id = GenerateNodeId(container, nodeType);
            InsertFolderItem.Perform(container, location, node);
            ClearRowSelection.Perform();
            SelectNode.Perform(node);
            Document.Current.Decorate(node);
            return(node);
        }