|
//Method to Validate whether create connection or Not
protected override void ValidateConnection(ConnectionParameter args)
{
//Necessary Conditions before create or nullify the connection
if ((args.Connector as ConnectorViewModel).SourcePort != null && (args.Connector as ConnectorViewModel).TargetPort != null)
{
if (((args.Connector as ConnectorViewModel).SourcePort as Customport).Color != ((args.Connector as ConnectorViewModel).TargetPort as Customport).Color)
{
args.TargetPort = null;
}
}
} |
|
//Method to Validate whether to Create connection or Not
protected override void ValidateConnection(ConnectionParameter args)
{
var con = args.Connector as ConnectorViewModel;
if (args.TargetPort != null)
{
//For getting source and target port
var target = args.TargetPort as Customport;
var source = con.SourcePort as Customport;
//To validate sourceport color and targetport color
if (target.Color != source.Color)
{
//Set targetport and targetnode as null
args.TargetPort = null;
args.TargetNode = null;
}
}
}
//Here args provided the necessary information of TargetPort,SourceNode,TargetNode based on the connection creation. |