public virtual void OnCurrentWorkspaceChanged(WorkspaceModel workspace) { if (CurrentWorkspaceChanged != null) { CurrentWorkspaceChanged(workspace); } }
public DummyNode(WorkspaceModel workspace) : base(workspace) { this.LegacyNodeName = "DSCoreNodesUI.DummyNode"; this.LegacyAssembly = string.Empty; this.NodeNature = Nature.Unresolved; }
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(); }
public DSFunction(WorkspaceModel ws, FunctionDescriptor definition) : base(ws) { ArgumentLacing = LacingStrategy.Shortest; Definition = definition; Initialize(); }
public WebRequest(WorkspaceModel workspace) : base(workspace) { InPortData.Add(new PortData("url", "The url for the web request.")); OutPortData.Add(new PortData("result", "The result of the web request.")); RegisterAllPorts(); }
/// <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; } }
public Formula(WorkspaceModel workspace) : base(workspace) { ArgumentLacing = LacingStrategy.Shortest; OutPortData.Add(new PortData("", "Result of math computation")); RegisterAllPorts(); }
protected ElementsQueryBase(WorkspaceModel workspaceModel) : base(workspaceModel) { var u = RevitDynamoModel.RevitServicesUpdater; u.ElementsAdded += Updater_ElementsAdded; u.ElementsModified += Updater_ElementsModified; u.ElementsDeleted += Updater_ElementsDeleted; }
internal void OnWorkspaceSaved(WorkspaceModel model) { if (WorkspaceSaved != null) { WorkspaceSaved(model); } }
/// <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(); }
/// <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(); }
protected virtual void OnWorkspaceAdded(WorkspaceModel obj) { var handler = WorkspaceAdded; if (handler != null) handler(obj); WorkspaceEvents.OnWorkspaceAdded(obj.Guid, obj.Name, obj.GetType()); }
public virtual void OnWorkspaceCleared(WorkspaceModel workspace) { if (WorkspaceCleared != null) WorkspaceCleared(workspace); WorkspaceEvents.OnWorkspaceCleared(); }
public WatchImageCore(WorkspaceModel ws) : base(ws) { InPortData.Add(new PortData("image", "image")); OutPortData.Add(new PortData("image", "image")); RegisterAllPorts(); }
protected virtual void OnWorkspaceRemoved(WorkspaceModel obj) { var handler = WorkspaceRemoved; if (handler != null) handler(obj); WorkspaceEvents.OnWorkspaceRemoved(obj.Guid, obj.Name); }
public GetWorksheetsFromExcelWorkbook(WorkspaceModel workspace) : base(workspace) { InPortData.Add(new PortData("workbook", "The excel workbook")); OutPortData.Add(new PortData("worksheets", "A list of worksheets")); RegisterAllPorts(); }
public ElementsOfFamilyType(WorkspaceModel workspaceModel) : base(workspaceModel) { InPortData.Add(new PortData("Family Type", "The Family Type.")); OutPortData.Add(new PortData("Elements", "The list of elements matching the query.")); RegisterAllPorts(); }
public GetExcelWorksheetByName(WorkspaceModel workspace) : base(workspace) { InPortData.Add(new PortData("workbook", "The excel workbook")); InPortData.Add(new PortData("name", "Name of the worksheet to get")); OutPortData.Add(new PortData("worksheet", "The worksheet with the given name")); RegisterAllPorts(); }
protected FileSystemBrowser(WorkspaceModel workspace, string tip) : base(workspace) { OutPortData[0].ToolTipString = tip; RegisterAllPorts(); Value = ""; }
public TwoScopedInputs(WorkspaceModel workspaceModel) : base(workspaceModel) { InPortData.Add(new PortData("port1", "Port1 block")); InPortData.Add(new PortData("port2", "Port2 block")); OutPortData.Add(new PortData("result", "Result")); RegisterAllPorts(); }
public ComposeFunctions(WorkspaceModel workspaceModel) : base(workspaceModel) { InPortData.Add(new PortData("func0", "Function #0")); InPortData.Add(new PortData("func1", "Function #1")); OutPortData.Add(new PortData("func", "Composed function.")); RegisterAllPorts(); }
public Map(WorkspaceModel workspace) : base(workspace) { InPortData.Add(new PortData("list", "The list to map over.")); InPortData.Add(new PortData("f(x)", "The procedure used to map elements")); OutPortData.Add(new PortData("mapped", "Mapped list")); RegisterAllPorts(); }
public ScopedIf(WorkspaceModel workspaceModel) : base(workspaceModel) { InPortData.Add(new PortData("test", "Test block")); InPortData.Add(new PortData("true", "True block")); InPortData.Add(new PortData("false", "False block")); OutPortData.Add(new PortData("result", "Result")); RegisterAllPorts(); }
protected BinaryLogic(WorkspaceModel workspaceModel, string symbol, Operator op) : base(workspaceModel) { _op = op; InPortData.Add(new PortData("bool0", "operand")); InPortData.Add(new PortData("bool1", "operand")); OutPortData.Add(new PortData("", "result")); RegisterAllPorts(); }
public CreateList(WorkspaceModel workspace) : base(workspace) { InPortData.Add(new PortData("index0", "Item Index #0")); OutPortData.Add(new PortData("list", "A list")); RegisterAllPorts(); ArgumentLacing = LacingStrategy.Disabled; }
public CodeBlockNodeModel(string userCode, Guid guid, WorkspaceModel workspace, double xPos, double yPos) : base(workspace) { ArgumentLacing = LacingStrategy.Disabled; this.X = xPos; this.Y = yPos; this.code = userCode; this.GUID = guid; this.shouldFocus = false; ProcessCodeDirect(); }
protected CombinatorNode(WorkspaceModel workspace) : this(workspace, 3) { InPortData.Add(new PortData("comb", "Combinator")); InPortData.Add(new PortData("list1", "List #1")); InPortData.Add(new PortData("list2", "List #2")); OutPortData.Add(new PortData("combined", "Combined lists")); RegisterAllPorts(); }
/// <summary> /// Factory method to create a connector. Checks to make sure that the start and end ports are valid, /// otherwise returns null. /// </summary> /// <param name="start">The port where the connector starts</param> /// <param name="end">The port where the connector ends</param> /// <param name="startIndex"></param> /// <param name="endIndex"></param> /// <param name="portType"></param> /// <returns>The valid connector model or null if the connector is invalid</returns> internal static ConnectorModel Make(WorkspaceModel workspaceModel, NodeModel start, NodeModel end, int startIndex, int endIndex, PortType portType) { if (workspaceModel != null && start != null && end != null && start != end && startIndex >= 0 && endIndex >= 0 && start.OutPorts.Count > startIndex && end.InPorts.Count > endIndex ) { return new ConnectorModel(workspaceModel, start, end, startIndex, endIndex, portType); } return null; }
public SunSettings(WorkspaceModel workspaceModel) : base(workspaceModel) { OutPortData.Add(new PortData("SunSettings", "SunSettings element.")); RegisterAllPorts(); RevitDynamoModel.RevitServicesUpdater.ElementsModified += Updater_ElementsModified; DocumentManager.Instance.CurrentUIApplication.ViewActivated += CurrentUIApplication_ViewActivated; CurrentUIApplicationOnViewActivated(); }
/// <summary> /// This method is called by task creator to associate the trace data with /// the current instance of virtual machine. The given WorkspaceModel can /// optionally contain saved trace data in a previous execution session. As /// a side-effect, this method resets "WorkspaceModel.PreloadedTraceData" /// data member to ensure the correctness of the execution flow. /// </summary> /// <param name="controller">Reference to the EngineController on which the /// loaded trace data should be set.</param> /// <param name="workspace">The workspace from which the trace data should /// be retrieved.</param> /// <returns>If the given WorkspaceModel contains saved trace data, this /// method returns true, in which case the task needs to be scheduled. /// Otherwise, the method returns false.</returns> /// internal bool Initialize(EngineController controller, WorkspaceModel workspace) { if (controller == null || (controller.LiveRunnerCore == null)) return false; engineController = controller; traceData = workspace.PreloadedTraceData; TargetedWorkspace = workspace; workspace.PreloadedTraceData = null; return ((traceData != null) && traceData.Any()); }
/// <summary> /// Updates relevant parameters on save /// </summary> /// <param name="model">The workspace that was just saved</param> private static void OnWorkspaceSaved(WorkspaceModel model) { model.LastSaved = DateTime.Now; model.HasUnsavedChanges = false; dynSettings.Controller.DynamoViewModel.AddToRecentFiles(model.FileName); }
public NoteModel(WorkspaceModel workspace, double x, double y) { this.workspaceModel = workspace; X = x; Y = y; }
public WorkspaceEventArgs(WorkspaceModel workspace) { this.Workspace = workspace; }