LunarPresentation/Commands/RowSideMove.cs

(开头部分) 35KB

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

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

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        public static void RosideMove(Widegets.RowOperationCommand cmd)
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

            LunarPresentation.Expressions.Row curRow
                = Globals.selectedEditor.SelectedExpression as Expressions.Row;

            if (curRow == null) return;

            if (curRow.ParentPanel == null) return;

            switch (cmd)
            {
                case Widegets.RowOperationCommand.LeftSideMoveLeft:
                    {
                        if (curRow.ParentPanel.Direction == Orientation.Vertical)
                        {
                            MessageBox.Show("“行”所在的父面板是“垂直”指向的,不能令“行”的左边界向左扩展!",
                                Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
                            return;
                        }

                        int indexOfCurRow = curRow.ParentPanel.BasePanel.Children.IndexOf(curRow);
                        if (indexOfCurRow <= 0 || indexOfCurRow >= curRow.ParentPanel.BasePanel.Children.Count) return;

                        Expressions.Expression ex = curRow.ParentPanel.BasePanel.Children[indexOfCurRow - 1] as Expressions.Expression;
                        if (ex == null) return;

                        //如果被折叠则是隐藏,此时不允许操作。
                        if (ex.Visibility != Visibility.Visible)
                        {
                            MessageBox.Show("“行”左侧的这个公式被某个标题文本块给折叠起来了,此时不允许扩展!",
                             Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
                            return;
                        }
                        else
                        {
                            Expressions.BaseText btxt = ex as Expressions.BaseText;
                            if (btxt != null && btxt.IsHeaderText && btxt.IsCollapsed)
                            {
                                MessageBox.Show("“行”左侧的这个公式是一个被折叠的标题文本块,此时不允许扩展!",
                                    Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
                                return;
                            }
                        }

                        //将ex移动到“行”内部。
                        ModifingItem mi = new ModifingItem() { OldSelectedExID = curRow.ExID, NewSelectedExID = curRow.ExID };

                        curRow.ParentPanel.XmlData.RemoveChild(ex.XmlData);

后面还有 605 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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