Compare commits
11 Commits
f9138ff444
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
385e932401 | ||
|
|
55573f6040 | ||
|
|
2efc34846c | ||
|
|
fb3db24b90 | ||
|
|
413985e08f | ||
|
|
7d18b88172 | ||
|
|
fdcef37be3 | ||
|
|
d7ff6b3109 | ||
|
|
cce2224926 | ||
|
|
23fc6c17e6 | ||
|
|
c6c1e41cb6 |
@@ -1,6 +1,8 @@
|
|||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Deedy.Testing;
|
||||||
|
|
||||||
namespace Deedy
|
namespace Deedy
|
||||||
{
|
{
|
||||||
@@ -9,6 +11,45 @@ namespace Deedy
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
public App()
|
||||||
|
{
|
||||||
|
string script =
|
||||||
|
@"
|
||||||
|
VarP var1 111
|
||||||
|
VarP var2 222
|
||||||
|
Func Add var1x var2x
|
||||||
|
LetP AddResult -1
|
||||||
|
math AddResult @var1x 777 + @var2 - @var2x -
|
||||||
|
retu AddResult
|
||||||
|
EndF
|
||||||
|
//调用自定义方法
|
||||||
|
Call Add @var1 99
|
||||||
|
PopV result
|
||||||
|
ifth true 4 3 <
|
||||||
|
letp result 248
|
||||||
|
else
|
||||||
|
letp result 80
|
||||||
|
endi
|
||||||
|
letp var1 1
|
||||||
|
letp var2 1
|
||||||
|
whil false @var1 10 <
|
||||||
|
math var1 @var1 ++
|
||||||
|
ifth false @var2 4 !=
|
||||||
|
math var2 @var2 ++
|
||||||
|
cont
|
||||||
|
var var3 xxx
|
||||||
|
else
|
||||||
|
brea
|
||||||
|
endi
|
||||||
|
endw
|
||||||
|
";
|
||||||
|
Todo todo = new();
|
||||||
|
todo.Init("varp var1 111");
|
||||||
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
|
for (int i = 0; i < 1000000; i++)
|
||||||
|
todo.Redo();
|
||||||
|
sw.Stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
1145
DeedyDesigner/Deedy.Testing/Dodo.cs
Normal file
1145
DeedyDesigner/Deedy.Testing/Dodo.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -19,7 +19,9 @@ namespace Deedy
|
|||||||
public class DrawerViewer : Adorner
|
public class DrawerViewer : Adorner
|
||||||
{
|
{
|
||||||
private readonly VisualCollection _visualChildren;
|
private readonly VisualCollection _visualChildren;
|
||||||
|
/// <summary>
|
||||||
|
/// 抽屉外边框
|
||||||
|
/// </summary>
|
||||||
private readonly Border _border;
|
private readonly Border _border;
|
||||||
public Brush Background { get => (Brush)GetValue(BackgroundProperty); set => SetValue(BackgroundProperty, value); }
|
public Brush Background { get => (Brush)GetValue(BackgroundProperty); set => SetValue(BackgroundProperty, value); }
|
||||||
public static readonly DependencyProperty BackgroundProperty = Border.BackgroundProperty.AddOwner(typeof(DrawerViewer));
|
public static readonly DependencyProperty BackgroundProperty = Border.BackgroundProperty.AddOwner(typeof(DrawerViewer));
|
||||||
@@ -29,7 +31,9 @@ namespace Deedy
|
|||||||
public static readonly DependencyProperty BorderThicknessProperty = Border.BorderThicknessProperty.AddOwner(typeof(DrawerViewer));
|
public static readonly DependencyProperty BorderThicknessProperty = Border.BorderThicknessProperty.AddOwner(typeof(DrawerViewer));
|
||||||
public CornerRadius CornerRadius { get => (CornerRadius)GetValue(CornerRadiusProperty); set => SetValue(CornerRadiusProperty, value); }
|
public CornerRadius CornerRadius { get => (CornerRadius)GetValue(CornerRadiusProperty); set => SetValue(CornerRadiusProperty, value); }
|
||||||
public static readonly DependencyProperty CornerRadiusProperty = Border.CornerRadiusProperty.AddOwner(typeof(DrawerViewer));
|
public static readonly DependencyProperty CornerRadiusProperty = Border.CornerRadiusProperty.AddOwner(typeof(DrawerViewer));
|
||||||
|
/// <summary>
|
||||||
|
/// 抽屉内容容器
|
||||||
|
/// </summary>
|
||||||
private readonly ContentPresenter _contentPresenter;
|
private readonly ContentPresenter _contentPresenter;
|
||||||
public object Content { get => GetValue(ContentProperty); set => SetValue(ContentProperty, value); }
|
public object Content { get => GetValue(ContentProperty); set => SetValue(ContentProperty, value); }
|
||||||
public static readonly DependencyProperty ContentProperty = ContentPresenter.ContentProperty.AddOwner(typeof(DrawerViewer));
|
public static readonly DependencyProperty ContentProperty = ContentPresenter.ContentProperty.AddOwner(typeof(DrawerViewer));
|
||||||
@@ -60,17 +64,6 @@ namespace Deedy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册附属视图;注册前请确保布局属性被正确设置
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="attachedView">要注册的附属视图;注册前请确保布局属性被正确设置</param>
|
|
||||||
/// <param name="dock">在注册的方向</param>
|
|
||||||
/// <returns>当前装饰器对象,方便连续操作;不会创建新的装饰器</returns>
|
|
||||||
public DrawerViewer RegisterAttachedView(UIElement attachedView, Dock? dock)
|
|
||||||
{
|
|
||||||
dock ??= (Dock)(((int)(this._direction ?? Dock.Left) + 2) % 4);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 在特定「UIElement」上创建「WindowDrawer」蒙层
|
/// 在特定「UIElement」上创建「WindowDrawer」蒙层
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="adornedElement">目标「UIElement」元素</param>
|
/// <param name="adornedElement">目标「UIElement」元素</param>
|
||||||
@@ -111,8 +104,14 @@ namespace Deedy
|
|||||||
|
|
||||||
_border.Child = _contentPresenter;
|
_border.Child = _contentPresenter;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 要注册的事件
|
||||||
|
/// </summary>
|
||||||
[AllowNull]
|
[AllowNull]
|
||||||
private readonly RoutedEvent[] _routedEvents;
|
private readonly RoutedEvent[] _routedEvents;
|
||||||
|
/// <summary>
|
||||||
|
/// 事件响应方法
|
||||||
|
/// </summary>
|
||||||
private readonly RoutedEventHandler? _routedEventHandler;
|
private readonly RoutedEventHandler? _routedEventHandler;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 在特定「UIElement」上创建「WindowDrawer」蒙层,同时绑定特定路由事件
|
/// 在特定「UIElement」上创建「WindowDrawer」蒙层,同时绑定特定路由事件
|
||||||
@@ -160,6 +159,10 @@ namespace Deedy
|
|||||||
_border.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
|
_border.Arrange(new Rect(0, 0, finalSize.Width, finalSize.Height));
|
||||||
return finalSize;
|
return finalSize;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 显示抽屉并播放入场动画
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="seconds">动画持续时间</param>
|
||||||
public void ShowWithAnimation(double seconds = 1)
|
public void ShowWithAnimation(double seconds = 1)
|
||||||
{
|
{
|
||||||
var doubleAnimation = new DoubleAnimation
|
var doubleAnimation = new DoubleAnimation
|
||||||
@@ -180,7 +183,10 @@ namespace Deedy
|
|||||||
};
|
};
|
||||||
_border.BeginAnimation(MarginProperty, marginAnimation);
|
_border.BeginAnimation(MarginProperty, marginAnimation);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 关闭抽屉并播放出场动画;同时清理事件注册
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="seconds">动画持续时间</param>
|
||||||
public void HideWithAnimation(double seconds = 1)
|
public void HideWithAnimation(double seconds = 1)
|
||||||
{
|
{
|
||||||
var doubleAnimation = new DoubleAnimation
|
var doubleAnimation = new DoubleAnimation
|
||||||
|
|||||||
Reference in New Issue
Block a user