mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-05-04 06:51:28 +08:00
block demo 已经完成到第三个了
This commit is contained in:
@@ -28,7 +28,7 @@ namespace AIStudio.Wpf.DiagramDesigner.Controls
|
|||||||
if (e.LeftButton == MouseButtonState.Pressed && firstPoint == null)
|
if (e.LeftButton == MouseButtonState.Pressed && firstPoint == null)
|
||||||
{
|
{
|
||||||
firstPoint = e.GetPosition(this);
|
firstPoint = e.GetPosition(this);
|
||||||
DesignerItem.BeforeExecute();
|
DesignerItem.BeforeExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static double ConvertToPositive360(double angle)
|
public static double ConvertToPositive360(double angle)
|
||||||
{
|
{
|
||||||
double positiveAngle = angle % 360;
|
double positiveAngle = angle % 360;
|
||||||
if (positiveAngle < 0)
|
if (positiveAngle < 0)
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
foreach (var child in designer.Children)
|
foreach (var child in designer.Children)
|
||||||
{
|
{
|
||||||
BlockDesignerItemViewModel fullyCreatedConnectorInfo = new BlockDesignerItemViewModel(this.Root, child);
|
BlockDesignerItemViewModel fullyCreatedConnectorInfo = new BlockDesignerItemViewModel(this.Root, child);
|
||||||
InsertChild(fullyCreatedConnectorInfo);
|
InsertChild(fullyCreatedConnectorInfo, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,16 +273,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
return double.IsNaN(ItemHeight) ? ActualItemHeight : ItemHeight;
|
return double.IsNaN(ItemHeight) ? ActualItemHeight : ItemHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertChild(BlockDesignerItemViewModel child)
|
|
||||||
{
|
|
||||||
child.ParentContainer = this;
|
|
||||||
Children.Add(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InsertChild(BlockDesignerItemViewModel child, int index)
|
public void InsertChild(BlockDesignerItemViewModel child, int index)
|
||||||
{
|
{
|
||||||
child.ParentContainer = this;
|
child.ParentContainer = this;
|
||||||
Children.Insert(index, child);
|
if (index == -1)
|
||||||
|
{
|
||||||
|
Children.Add(child);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Children.Insert(index, child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveChild(BlockDesignerItemViewModel child)
|
public void RemoveChild(BlockDesignerItemViewModel child)
|
||||||
|
|||||||
@@ -392,15 +392,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICommand _nextCommand;
|
|
||||||
public ICommand NextCommand
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this._nextCommand ?? (this._nextCommand = new SimpleCommand(ExecuteEnable, ExecuteNextCommand));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ICommand _alignTopCommand;
|
private ICommand _alignTopCommand;
|
||||||
public ICommand AlignTopCommand
|
public ICommand AlignTopCommand
|
||||||
{
|
{
|
||||||
@@ -1067,10 +1058,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ExecuteNextCommand(object parameter)
|
public virtual bool Next()
|
||||||
{
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteSelectAllCommand(object parameter)
|
private void ExecuteSelectAllCommand(object parameter)
|
||||||
{
|
{
|
||||||
@@ -2777,8 +2768,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
}
|
}
|
||||||
else if (DiagramOption.ShortcutOption.Next(e))
|
else if (DiagramOption.ShortcutOption.Next(e))
|
||||||
{
|
{
|
||||||
NextCommand.Execute(null);
|
//NextCommand.Execute(null);
|
||||||
return true;
|
return Next();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -469,23 +469,35 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
public async Task Execute()
|
public async Task Execute()
|
||||||
{
|
{
|
||||||
await BeforeExecute();
|
await StopExecution();
|
||||||
await Executing();
|
await BeforeExecution();
|
||||||
await AfterExecute();
|
if (await Executing())
|
||||||
|
{
|
||||||
|
await AfterExecution();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsExecuting = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Task BeforeExecute()
|
public virtual Task BeforeExecution()
|
||||||
{
|
{
|
||||||
IsExecuting = true;
|
IsExecuting = true;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Task Executing()
|
public virtual Task<bool> Executing()
|
||||||
|
{
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual Task StopExecution()
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual async Task AfterExecute()
|
public virtual async Task AfterExecution()
|
||||||
{
|
{
|
||||||
if (IsExecuting)
|
if (IsExecuting)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,10 +41,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
}
|
}
|
||||||
ICommand NextCommand
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
ICommand AlignTopCommand
|
ICommand AlignTopCommand
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -340,6 +336,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
|||||||
|
|
||||||
void Delete(object parameter);
|
void Delete(object parameter);
|
||||||
|
|
||||||
|
bool Next();
|
||||||
|
|
||||||
void ClearSelectedItems();
|
void ClearSelectedItems();
|
||||||
|
|
||||||
bool ExecuteShortcut(KeyEventArgs e);
|
bool ExecuteShortcut(KeyEventArgs e);
|
||||||
|
|||||||
@@ -620,9 +620,17 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExecuteNextCommand(object parameter)
|
public override bool Next()
|
||||||
{
|
{
|
||||||
ExecuteAddPearCommand(parameter);
|
if (SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
ExecuteAddPearCommand(null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteMoveBackCommand(object parameter)
|
private void ExecuteMoveBackCommand(object parameter)
|
||||||
|
|||||||
Reference in New Issue
Block a user