LunarPresentation/Commands/Comment.cs

(完整代码) 1KB

using SHomeWorkshop.LunarPresentation.Dialogs;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void Comment(MainWindow window)
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            Expressions.BaseText bt = Globals.selectedEditor.SelectedExpression as Expressions.BaseText;
            if (bt != null)
            {
                Command.EditBaseText(bt, null, true);
                return;
            }

            string text = string.Empty;
            if (Globals.selectedEditor.SelectedExpression.CommentText != null)
            {
                text = Globals.selectedEditor.SelectedExpression.CommentText;
            }

            InputWindow iw = new InputWindow(window, "请输入公式备注文本:", text, Globals.appName) { Owner = Globals.MainWindow };
            Globals.SwitchInputMethod(true);

            if (iw.ShowDialog() == true)
            {
                Expressions.Expression ex = Globals.selectedEditor.SelectedExpression;
                ModifingItem mi = new ModifingItem();
                Action action = new Action(ex.ExID,
                    -1, ex.GetType().Name, "CommentText", ex.CommentText, iw.InputedText);
                Globals.selectedEditor.SelectedExpression.CommentText = iw.InputedText;
                mi.Add(action);
                ex.Editor.Do(mi);
            }

            Globals.SwitchInputMethod(false);
        }
    }
}

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

AI 解读 AI

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

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