本文整理汇总了C#中Dynamo.Models.ConnectorModel类的典型用法代码示例。如果您正苦于以下问题:C# ConnectorModel类的具体用法?C# ConnectorModel怎么用?C# ConnectorModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectorModel类属于Dynamo.Models命名空间,在下文中一共展示了ConnectorModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnectorAdded
protected virtual void OnConnectorAdded(ConnectorModel obj)
{
RegisterConnector(obj);
var handler = ConnectorAdded;
if (handler != null) handler(obj);
}
示例2: PortConnectedHandler
protected override void PortConnectedHandler(PortModel arg1, ConnectorModel arg2)
{
UpdateUpstream();
}
示例3: IsInternalNodeToCodeConnection
/// <summary>
/// Checks whether the given connection is inside the node to code set or outside it.
/// This determines if it should be redrawn(if it is external) or if it should be
/// deleted (if it is internal)
/// </summary>
private static bool IsInternalNodeToCodeConnection(IEnumerable<NodeModel> nodes, ConnectorModel connector)
{
return nodes.Contains(connector.Start.Owner) && nodes.Contains(connector.End.Owner);
}
示例4: OnPortConnected
/// <summary>
/// Called when a port is connected.
/// </summary>
/// <param name="connector"></param>
protected virtual void OnPortConnected(ConnectorModel connector)
{
if (PortConnected != null)
PortConnected(this, connector);
}
示例5: DynamoModel_ConnectorDeleted
/// <summary>
/// Handler for the model's ConnectorDeleted event.
/// </summary>
/// <param name="connector"></param>
private void DynamoModel_ConnectorDeleted(ConnectorModel connector)
{
// TODO: Ian should remove this when the CBN reconnection bug is solved.
/*if (connector.Start.Owner.GetType() == typeof(CodeBlockNodeModel))
{
return;
}
//we are given the connector that was deleted
//if it's end node still exists, clear the package for
//the node and trigger an update.
if (connector.End != null)
connector.End.Owner.ClearRenderPackages();
//tell the watches that they require re-binding.
QueueRenderTask();*/
}
示例6: OnConnectorDeleted
internal void OnConnectorDeleted(ConnectorModel connector)
{
if (ConnectorDeleted != null)
{
ConnectorDeleted(connector);
}
}
示例7: Disconnect
public void Disconnect(ConnectorModel connector)
{
if (!connectors.Contains(connector))
return;
//throw the event for a connection
OnPortDisconnected(EventArgs.Empty);
//also trigger the model's connector deletion
owner.Workspace.DynamoModel.OnConnectorDeleted(connector);
connectors.Remove(connector);
//don't set back to white if
//there are still connectors on this port
if (connectors.Count == 0)
{
IsConnected = false;
}
Owner.ValidateConnections();
}
示例8: IsInternalNodeToCodeConnection
/// <summary>
/// Checks whether the given connection is inside the node to code set or outside it.
/// This determines if it should be redrawn(if it is external) or if it should be
/// deleted (if it is internal)
/// </summary>
private bool IsInternalNodeToCodeConnection(ConnectorModel connector)
{
return DynamoSelection.Instance.Selection.Contains(connector.Start.Owner) && DynamoSelection.Instance.Selection.Contains(connector.End.Owner);
}
示例9: Connectors_ConnectorAdded
void Connectors_ConnectorAdded(ConnectorModel c)
{
var viewModel = new ConnectorViewModel(this, c);
if (_connectors.All(x => x.ConnectorModel != c))
_connectors.Add(viewModel);
}
示例10: ConnectorViewModel
/// <summary>
/// Construct a view and respond to property changes on the model.
/// </summary>
/// <param name="model"></param>
public ConnectorViewModel(ConnectorModel model)
{
_model = model;
_model.PropertyChanged += Model_PropertyChanged;
_model.Start.Owner.PropertyChanged += StartOwner_PropertyChanged;
_model.End.Owner.PropertyChanged += EndOwner_PropertyChanged;
dynSettings.Controller.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;
Redraw();
}
示例11: ConnectorViewModel
/// <summary>
/// Construct a view and respond to property changes on the model.
/// </summary>
/// <param name="model"></param>
public ConnectorViewModel(WorkspaceViewModel workspace, ConnectorModel model)
{
this.workspaceViewModel = workspace;
_model = model;
_model.PropertyChanged += Model_PropertyChanged;
_model.Start.Owner.PropertyChanged += StartOwner_PropertyChanged;
_model.End.Owner.PropertyChanged += EndOwner_PropertyChanged;
workspaceViewModel.DynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;
Redraw();
}
示例12: DynamoModel_ConnectorDeleted
/// <summary>
/// Handler for the model's ConnectorDeleted event. Clears the visualization for
/// the node at the 'end' of the connector.
/// </summary>
/// <param name="connector"></param>
void DynamoModel_ConnectorDeleted(ConnectorModel connector)
{
if (Visualizations.ContainsKey(connector.End.Owner.GUID.ToString()))
{
Visualizations.Remove(connector.End.Owner.GUID.ToString());
//tell the watches that they require re-binding.
//OnVisualizationUpdateComplete(this, new VisualizationEventArgs(AggregateRenderDescriptions()));
OnVisualizationUpdateComplete(this, EventArgs.Empty);
}
}
示例13: DynamoModel_ConnectorDeleted
/// <summary>
/// Handler for the model's ConnectorDeleted event.
/// </summary>
/// <param name="connector"></param>
void DynamoModel_ConnectorDeleted(ConnectorModel connector)
{
//we are given the connector that was deleted
//if it's end node still exists, clear the package for
//the node and trigger an update.
if (connector.End != null)
connector.End.Owner.ClearRenderPackages();
//tell the watches that they require re-binding.
OnVisualizationUpdateComplete(this, EventArgs.Empty);
}
示例14: OnConnectorAdded
/// <summary>
/// Called when a connector is added.
/// </summary>
/// <param name="connector"></param>
private void OnConnectorAdded(ConnectorModel connector)
{
if (ConnectorAdded != null)
{
ConnectorAdded(connector);
}
}
示例15: RegisterConnector
private void RegisterConnector(ConnectorModel connector)
{
connector.Deleted += () => OnConnectorDeleted(connector);
}