mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
1.1.1
This commit is contained in:
@@ -21,6 +21,15 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; private set;
|
||||
}
|
||||
|
||||
public virtual bool EnableAddInput
|
||||
{
|
||||
get;
|
||||
} = false;
|
||||
|
||||
public virtual bool EnableAddOutput
|
||||
{
|
||||
get;
|
||||
} = false;
|
||||
|
||||
public LogicalGateItemViewModelBase(LogicalType logicalType) : this(null, logicalType)
|
||||
{
|
||||
@@ -29,71 +38,17 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public LogicalGateItemViewModelBase(IDiagramViewModel root, LogicalType logicalType) : base(root)
|
||||
{
|
||||
this.LogicalType = logicalType;
|
||||
|
||||
if (this.LogicalType == LogicalType.Input)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.Output)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.Constant)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.Time)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.None)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.NOT)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else if (this.LogicalType == LogicalType.SEL)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null, 0);
|
||||
ExecuteAddInput(null, 1);
|
||||
ExecuteAddInput(null, 2);
|
||||
ExecuteAddOutput(null, 0);
|
||||
}
|
||||
else if (this.LogicalType >= LogicalType.ABS && this.LogicalType <= LogicalType.EXPT)
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearConnectors();
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddInput(null);
|
||||
ExecuteAddOutput(null);
|
||||
}
|
||||
BuildMenuOptions();
|
||||
this.LogicalType = logicalType;
|
||||
}
|
||||
|
||||
public LogicalGateItemViewModelBase(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
BuildMenuOptions();
|
||||
|
||||
}
|
||||
|
||||
public LogicalGateItemViewModelBase(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
|
||||
{
|
||||
BuildMenuOptions();
|
||||
|
||||
}
|
||||
|
||||
public override SelectableItemBase GetSerializableObject()
|
||||
@@ -107,6 +62,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
ShowArrow = false;
|
||||
AddInputCommand = new SimpleCommand(Command_Enable, para => ExecuteAddInput(para));
|
||||
AddOutputCommand = new SimpleCommand(Command_Enable, para => ExecuteAddOutput(para));
|
||||
BuildMenuOptions();
|
||||
|
||||
base.Init(root, initNew);
|
||||
}
|
||||
@@ -118,21 +74,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
private void BuildMenuOptions()
|
||||
{
|
||||
bool enAddInput = false;
|
||||
bool enAddOutput = false;
|
||||
if (LogicalType >= LogicalType.ADD && LogicalType <= LogicalType.AVE)
|
||||
{
|
||||
enAddInput = true;
|
||||
enAddOutput = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
enAddInput = false;
|
||||
enAddOutput = false;
|
||||
}
|
||||
|
||||
menuOptions = new ObservableCollection<CinchMenuItem>();
|
||||
if (enAddInput == true)
|
||||
if (EnableAddInput == true)
|
||||
{
|
||||
CinchMenuItem menuItem = new CinchMenuItem();
|
||||
menuItem.Text = "添加输入";
|
||||
@@ -140,7 +83,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
menuItem.CommandParameter = menuItem;
|
||||
menuOptions.Add(menuItem);
|
||||
}
|
||||
if (enAddOutput == true)
|
||||
if (EnableAddOutput == true)
|
||||
{
|
||||
CinchMenuItem menuItem = new CinchMenuItem();
|
||||
menuItem.Text = "添加输出";
|
||||
|
||||
Reference in New Issue
Block a user