LunarPresentation/Commands/InsertExpression.cs

(开头部分) 17KB

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

using System;
using System.Windows;
using System.Windows.Controls;
using System.Xml;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        /// <summary>
        /// 插入公式。默认插入在当前公式后面(下侧)。
        /// </summary>
        /// <param name="destExType">公式类型。</param>
        /// <param name="destExXmlText">公式后台Xml文本,通常是定义在资源文件中的某个字符串。
        /// 注意类型必须相符!!!</param>
        private static Expressions.Expression InsertExpression(TypeOfExpression destExType,
            string destExXmlText)
        {
            return InsertExpression(destExType, destExXmlText, true);
        }

        /// <summary>
        /// 插入公式。
        /// </summary>
        /// <param name="destExType">公式类型。</param>
        /// <param name="destExXmlText">公式后台Xml文本,通常是定义在资源文件中的某个字符串。
        /// <para name="insertAtBottom">插入位置,在当前公式前面(上侧)还是后面(下侧)。</para>
        /// 注意类型必须相符!!!</param>
        /// <param name="insertAtBottom">是否在底部插入。</param>
        /// <param name="mi">传入“撤销”与“重做”列表项。以防止需要多步才能撤销。
        /// 如果mi不为空,则不会在“撤销列表”中添加(插入公式)这一Action。</param>
        public static Expressions.Expression InsertExpression(TypeOfExpression destExType,
            string destExXmlText, bool insertAtBottom, ModifingItem mi = null)
        {
            if (Globals.selectedEditor == null) return null;
            if (Globals.selectedEditor.SelectedExpression == null)
            {
                System.Windows.MessageBox.Show("请先选取一个公式,然后再执行此操作。新公式将出现在选中公式的后面!",
                    Globals.appName, System.Windows.MessageBoxButton.OK,
                    System.Windows.MessageBoxImage.Warning);
                return null;
            }

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

            if (mi != null)
            {
                mi.OldSelectedExID = curEx.ExID;
            }

            if (curEx is Expressions.SubPanel)
            {
                //System.Windows.MessageBox.Show("不能在子面板后面插入新公式,请选择其它位置!",
                //    Globals.appName, System.Windows.MessageBoxButton.OK,
                //    System.Windows.MessageBoxImage.Warning);
                //return null;

                Expressions.SubPanel subPanel = curEx as Expressions.SubPanel;
                if (subPanel.BasePanel != null && subPanel.BasePanel.Children.Count > 0 &&
                    subPanel.BasePanel.Children[subPanel.BasePanel.Children.Count - 1] is Expressions.Expression)
后面还有 334 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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