本文整理汇总了C#中Dynamo.Models.WorkspaceModel类的典型用法代码示例。如果您正苦于以下问题:C# WorkspaceModel类的具体用法?C# WorkspaceModel怎么用?C# WorkspaceModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkspaceModel类属于Dynamo.Models命名空间,在下文中一共展示了WorkspaceModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElementsQueryBase
protected ElementsQueryBase(WorkspaceModel workspaceModel) : base(workspaceModel)
{
var u = RevitDynamoModel.RevitServicesUpdater;
u.ElementsAdded += Updater_ElementsAdded;
u.ElementsModified += Updater_ElementsModified;
u.ElementsDeleted += Updater_ElementsDeleted;
}
示例2: DummyNode
public DummyNode(WorkspaceModel workspace)
: base(workspace)
{
this.LegacyNodeName = "DSCoreNodesUI.DummyNode";
this.LegacyAssembly = string.Empty;
this.NodeNature = Nature.Unresolved;
}
示例3: Initialize
/// <summary>
/// Call this method to determine if the task should be scheduled for
/// execution.
/// </summary>
/// <param name="workspaceModel">Render packages for all the nodes in
/// this workspaceModel will be extracted, if 'nodeModel' parameter is
/// null.</param>
/// <param name="nodeModel">An optional NodeModel from which all upstream
/// nodes are to be examined for render packages. If this parameter is
/// null, render packages are extracted from all nodes in workspaceModel.
/// </param>
/// <returns>Returns true if the task should be scheduled for execution,
/// or false otherwise.</returns>
///
internal bool Initialize(WorkspaceModel workspaceModel, NodeModel nodeModel)
{
if (workspaceModel == null)
throw new ArgumentNullException("workspaceModel");
if (nodeModel == null) // No node is specified, gather all nodes.
{
NodeId = Guid.Empty;
// Duplicate a list of all nodes for consumption later.
duplicatedNodeReferences = workspaceModel.Nodes.ToList();
}
else
{
NodeId = nodeModel.GUID;
// Recursively gather all upstream nodes.
var gathered = new List<NodeModel>();
GatherAllUpstreamNodes(nodeModel, gathered);
duplicatedNodeReferences = gathered;
}
Debug.WriteLine(string.Format("Aggregation task initialized for {0}", nodeModel == null?"null":nodeModel.GUID.ToString()));
return duplicatedNodeReferences.Any();
}
示例4: Initialize
/// <summary>
/// Call this method to determine if the task should be scheduled for
/// execution.
/// </summary>
/// <param name="workspaceModel">Render packages for all the nodes in
/// this workspaceModel will be extracted, if 'nodeModel' parameter is
/// null.</param>
/// <param name="nodeModel">An optional NodeModel from which all upstream
/// nodes are to be examined for render packages. If this parameter is
/// null, render packages are extracted from all nodes in workspaceModel.
/// </param>
/// <returns>Returns true if the task should be scheduled for execution,
/// or false otherwise.</returns>
///
internal bool Initialize(WorkspaceModel workspaceModel, NodeModel nodeModel)
{
if (workspaceModel == null)
throw new ArgumentNullException("workspaceModel");
if (nodeModel == null) // No node is specified, gather all nodes.
{
targetedNodeId = Guid.Empty;
// Duplicate a list of all nodes for consumption later.
var nodes = workspaceModel.Nodes.Where(n => n.IsVisible);
duplicatedNodeReferences = nodes.ToList();
}
else
{
targetedNodeId = nodeModel.GUID;
// Recursively gather all upstream nodes. Stop
// gathering if this node does not display upstream.
var gathered = new List<NodeModel>();
WorkspaceUtilities.GatherAllUpstreamNodes(nodeModel,
gathered, model => model.IsUpstreamVisible);
duplicatedNodeReferences = gathered;
}
return duplicatedNodeReferences.Any();
}
示例5: OnWorkspaceAdded
protected virtual void OnWorkspaceAdded(WorkspaceModel obj)
{
var handler = WorkspaceAdded;
if (handler != null) handler(obj);
WorkspaceEvents.OnWorkspaceAdded(obj.Guid, obj.Name, obj.GetType());
}
示例6: OnWorkspaceCleared
public virtual void OnWorkspaceCleared(WorkspaceModel workspace)
{
if (WorkspaceCleared != null)
WorkspaceCleared(workspace);
WorkspaceEvents.OnWorkspaceCleared();
}
示例7: WatchImageCore
public WatchImageCore(WorkspaceModel ws) : base(ws)
{
InPortData.Add(new PortData("image", "image"));
OutPortData.Add(new PortData("image", "image"));
RegisterAllPorts();
}
示例8: Formula
public Formula(WorkspaceModel workspace)
: base(workspace)
{
ArgumentLacing = LacingStrategy.Shortest;
OutPortData.Add(new PortData("", "Result of math computation"));
RegisterAllPorts();
}
示例9: DSFunction
public DSFunction(WorkspaceModel ws, FunctionDescriptor definition)
: base(ws)
{
ArgumentLacing = LacingStrategy.Shortest;
Definition = definition;
Initialize();
}
示例10: GetWorksheetsFromExcelWorkbook
public GetWorksheetsFromExcelWorkbook(WorkspaceModel workspace)
: base(workspace)
{
InPortData.Add(new PortData("workbook", "The excel workbook"));
OutPortData.Add(new PortData("worksheets", "A list of worksheets"));
RegisterAllPorts();
}
示例11: OnWorkspaceSaved
internal void OnWorkspaceSaved(WorkspaceModel model)
{
if (WorkspaceSaved != null)
{
WorkspaceSaved(model);
}
}
示例12: OnWorkspaceRemoved
protected virtual void OnWorkspaceRemoved(WorkspaceModel obj)
{
var handler = WorkspaceRemoved;
if (handler != null) handler(obj);
WorkspaceEvents.OnWorkspaceRemoved(obj.Guid, obj.Name);
}
示例13: ApplyFunction
public ApplyFunction(WorkspaceModel workspaceModel) : base(workspaceModel)
{
InPortData.Add(new PortData("func", "Function to apply."));
OutPortData.Add(new PortData("func(args)", "Result of application."));
AddInput();
RegisterAllPorts();
}
示例14: Initialize
/// <summary>
/// This method is called by code that intends to start a graph update.
/// This method is called on the main thread where node collection in a
/// WorkspaceModel can be safely accessed.
/// </summary>
/// <param name="controller">Reference to an instance of EngineController
/// to assist in generating GraphSyncData object for the given set of nodes.
/// </param>
/// <param name="workspace">Reference to the WorkspaceModel from which a
/// set of updated nodes is computed. The EngineController generates the
/// resulting GraphSyncData from this list of updated nodes.</param>
/// <returns>Returns true if there is any GraphSyncData, or false otherwise
/// (in which case there will be no need to schedule UpdateGraphAsyncTask
/// for execution).</returns>
///
internal bool Initialize(EngineController controller, WorkspaceModel workspace)
{
try
{
engineController = controller;
TargetedWorkspace = workspace;
ModifiedNodes = ComputeModifiedNodes(workspace);
graphSyncData = engineController.ComputeSyncData(workspace.Nodes, ModifiedNodes, verboseLogging);
if (graphSyncData == null)
return false;
// We clear dirty flags before executing the task. If we clear
// flags after the execution of task, for example in
// AsyncTask.Completed or in HandleTaskCompletionCore(), as both
// are executed in the other thread, although some nodes are
// modified and we request graph execution, but just before
// computing sync data, the task completion handler jumps in
// and clear dirty flags. Now graph sync data will be null and
// graph is in wrong state.
foreach (var nodeGuid in graphSyncData.NodeIDs)
{
var node = workspace.Nodes.FirstOrDefault(n => n.GUID.Equals(nodeGuid));
if (node != null)
node.ClearDirtyFlag();
}
return true;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("UpgradeGraphAsyncTask saw: " + e.ToString());
return false;
}
}
示例15: OnCurrentWorkspaceChanged
public virtual void OnCurrentWorkspaceChanged(WorkspaceModel workspace)
{
if (CurrentWorkspaceChanged != null)
{
CurrentWorkspaceChanged(workspace);
}
}