LunarPresentation/Commands/SelectTop.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.Windows;
using System.Windows.Controls;
namespace SHomeWorkshop.LunarPresentation.Commands
{
public partial class Command
{
public static void SelectTop()
{
if (Globals.selectedEditor == null) return;
// 正常模式,选取公式。
if (Globals.selectedEditor.SelectedExpression == null)
{
if (Globals.selectedEditor.RootPanel != null)
{
Globals.selectedEditor.SelectedExpression
= Globals.selectedEditor.RootPanel;
}
return;
}
LunarPresentation.Expressions.Expression curEx
= Globals.selectedEditor.SelectedExpression;
if (curEx is Expressions.SubPanel)
{
Expressions.SubPanel subPanel = curEx as Expressions.SubPanel;
Expressions.SubPanel topPanel = subPanel.TopSubPanel;
if (topPanel != null)
{
curEx.Editor.SelectedExpression = topPanel;
}
else
{
if (subPanel.ParentExpression != null)
{
curEx.Editor.SelectedExpression = subPanel.ParentExpression;
}
}
return;
}
if (curEx.Parent is StackPanel)
{
StackPanel spanel = curEx.Parent as StackPanel;
if (spanel.Orientation == Orientation.Vertical)
{
int curIndex = spanel.Children.IndexOf(curEx);
if (curIndex > 0)
{
if (spanel.Children[curIndex - 1] is Expressions.Expression)
{
if ((spanel.Children[curIndex - 1] as Expressions.Expression).Visibility != Visibility.Visible)
{
//如果不可见,说明可能是被当前公式前面的某个标题文本块给“折叠”了,
//而当前公式未必是个“标题文本块”——这与SelectBottom不同。
//这里用简便的实现方法,直接取“上一个可见公式”。
后面还有 65 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。