调整一下删除拷贝,我也不记得之前为啥这样写了。

This commit is contained in:
艾竹
2023-04-24 22:43:56 +08:00
parent dea5a5341c
commit aa8ab61e37
4 changed files with 34 additions and 23 deletions

View File

@@ -68,17 +68,22 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
public ConnectorValueType _valueType;
public ConnectorValueType _connectorValueType;
public ConnectorValueType ConnectorValueType
{
get
{
return _valueType;
return _connectorValueType;
}
set
{
SetProperty(ref _valueType, value);
SetProperty(ref _connectorValueType, value);
}
}
public bool IsError
{
get;set;
}
}
}

View File

@@ -1420,6 +1420,7 @@ namespace AIStudio.Wpf.DiagramDesigner
if (parameter is SelectableDesignerItemViewModelBase ite)
{
ite.IsSelected = false;
ite.Dispose();
Items.Remove(ite);
}
else if (parameter is IEnumerable<SelectableDesignerItemViewModelBase> items)
@@ -1427,6 +1428,7 @@ namespace AIStudio.Wpf.DiagramDesigner
foreach (var item in items)
{
item.IsSelected = false;
item.Dispose();
Items.Remove(item);
}
}
@@ -1451,18 +1453,12 @@ namespace AIStudio.Wpf.DiagramDesigner
if (olditems.Any())
{
DoCommandManager.DoNewCommand(this.ToString(),
() => {
foreach (var item in olditems)
{
Items.Remove(item);
}
},
() => {
foreach (var item in olditems)
{
Items.Add(item);
}
});
() => {
Remove(olditems);
},
() => {
Add(olditems);
});
}
}
@@ -3040,27 +3036,33 @@ namespace AIStudio.Wpf.DiagramDesigner
}
else if (DiagramOption.ShortcutOption.Copy(e))
{
return Copy(null) != null;
CopyCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.Paste(e))
{
return Paste(null) != null;
PasteCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.Cut(e))
{
return Cut(null) != null;
CutCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.Undo(e))
{
return Undo(null);
UndoCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.Redo(e))
{
return Redo(null);
RedoCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.Delete(e))
{
return Delete(null) != null;
DeleteCommand.Execute(null);
return true;
}
else if (DiagramOption.ShortcutOption.LeftMove(e))
{

View File

@@ -14,7 +14,7 @@ using Newtonsoft.Json;
namespace AIStudio.Wpf.DiagramDesigner
{
public abstract class SelectableViewModelBase : BindableBase, ISelectable
public abstract class SelectableViewModelBase : BindableBase, ISelectable, IDisposable
{
protected IDiagramServiceProvider _service
{