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

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

View File

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

View File

@@ -303,7 +303,11 @@ namespace AIStudio.Wpf.DiagramDesigner
{ {
foreach (var output in Output) foreach (var output in Output)
{ {
if (output.Value.ConnectorValueType == ConnectorValueType.Bool) if (output.Value.IsError)
{
output.Value.ColorViewModel.FillColor.Color = Colors.Orange;
}
else if (output.Value.ConnectorValueType == ConnectorValueType.Bool)
{ {
if (output.Value.ConnectorValue == 0) if (output.Value.ConnectorValue == 0)
{ {