LunarPresentation/Commands/Tree/InsertNextLevelLeaf.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Windows;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void InsertAndEditNextLevelLeaf()
        {
            Expressions.LeafPanel newLeaf = Command.InsertNextLevelLeaf();
            if (newLeaf != null)
            {
                Command.EditFstBaseText();
                Globals.selectedEditor.SelectedExpression = newLeaf;
            }
        }

        private static Expressions.LeafPanel InsertNextLevelLeaf()
        {
            if (Globals.selectedEditor == null) return null;
            if (Globals.selectedEditor.SelectedExpression == null) return null;

            LunarPresentation.Expressions.Expression curEx
                = Globals.selectedEditor.SelectedExpression;

            if (curEx is Expressions.LeafPanel == false)
            {
                MessageBox.Show("请先选中一个叶面板!", Globals.appName,
                    MessageBoxButton.OK, MessageBoxImage.Warning);
                return null;
            }

            Expressions.LeafPanel curLeaf = curEx as Expressions.LeafPanel;

            if (curLeaf.ParentExpression == null ||
                curLeaf.ParentExpression is Expressions.Tree == false)
            {
                MessageBox.Show("发生意外,此叶面板不在任何树中!", Globals.appName,
                    MessageBoxButton.OK, MessageBoxImage.Warning);
                return null;
            }

            Expressions.Tree pTree = curLeaf.ParentExpression as Expressions.Tree;

            ModifingItem mi = new ModifingItem() { OldSelectedExID = curLeaf.ExID };

            if (curLeaf.IsCollapsed)
            {
                Action actCollapsed = new Action(curLeaf.ExID, -1, curLeaf.GetType().Name,
                    "IsCollapsed", true.ToString(), false.ToString());

                curLeaf.IsCollapsed = false;

                mi.Add(actCollapsed);
            }

            Expressions.LeafPanel newLeaf = pTree.InsertNextLevelLeaf(curLeaf, mi);
            if (newLeaf != null)
            {
                pTree.Editor.Do(mi);
                pTree.Editor.IsModified = true;
后面还有 9 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。