LunarPresentation/Commands/SwitchDirection.cs

(开头部分) 4KB

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

using System.Windows;
using System.Windows.Controls;
using SHomeWorkshop.LunarPresentation.Interfaces;

namespace SHomeWorkshop.LunarPresentation.Commands
{
    public partial class Command
    {
        /// <summary>
        /// 切换[水平/垂直]对齐方式。
        /// </summary>
        public static void SwitchDirection()
        {
            if (Globals.selectedEditor == null) return;
            if (Globals.selectedEditor.SelectedExpression == null) return;

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

            if (curEx is IDirection)
            {
                if (curEx is Expressions.SubPanel)
                {
                    foreach (UIElement ue in (curEx as Expressions.SubPanel).BasePanel.Children)
                    {
                        Expressions.BaseText bt = ue as Expressions.BaseText;

                        if (bt != null && bt.IsCollapsed)
                        {
                            MessageBox.Show("此子面板中有标题文本块处于“折叠”状态,不允许切换为水平指向!",
                                Globals.appName, MessageBoxButton.OK, MessageBoxImage.Warning);
                            return;
                        }
                    }
                }

                ModifingItem mi = new ModifingItem();
                Action action;

                IDirection idrection = curEx as IDirection;
                if (idrection.Direction == Orientation.Horizontal)
                {
                    action = new Action(curEx.ExID, -1, curEx.GetType().Name, "Direction",
                        idrection.Direction.ToString(), Orientation.Vertical.ToString());
                    idrection.Direction = Orientation.Vertical;
                }
                else
                {
                    action = new Action(curEx.ExID, -1, curEx.GetType().Name, "Direction",
                           idrection.Direction.ToString(), Orientation.Horizontal.ToString());
                    idrection.Direction = Orientation.Horizontal;
                }

                Globals.MainWindow.btnIndent.IsEnabled = Command.CanIndent(curEx);
                Globals.MainWindow.btnOutdent.IsEnabled = Command.CanOutdent(curEx);

                mi.Add(action);
                curEx.Editor.Do(mi);

                curEx.Editor.IsModified = true;
后面还有 55 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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