コード例 #1
0
ファイル: DynamoModelEvents.cs プロジェクト: whztt07/Dynamo
 public virtual void OnCurrentWorkspaceChanged(WorkspaceModel workspace)
 {
     if (CurrentWorkspaceChanged != null)
     {
         CurrentWorkspaceChanged(workspace);
     }
 }
コード例 #2
0
ファイル: DummyNode.cs プロジェクト: RobertiF/Dynamo
 public DummyNode(WorkspaceModel workspace)
     : base(workspace)
 {
     this.LegacyNodeName = "DSCoreNodesUI.DummyNode";
     this.LegacyAssembly = string.Empty;
     this.NodeNature = Nature.Unresolved;
 }
コード例 #3
0
ファイル: Apply.cs プロジェクト: RobertiF/Dynamo
 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();
 }
コード例 #4
0
ファイル: DSFunction.cs プロジェクト: RobertiF/Dynamo
 public DSFunction(WorkspaceModel ws, FunctionDescriptor definition)
     : base(ws)
 {
     ArgumentLacing = LacingStrategy.Shortest;
     Definition = definition;
     Initialize();
 }
コード例 #5
0
ファイル: WebRequest.cs プロジェクト: RobertiF/Dynamo
 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();
 }
コード例 #6
0
        /// <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;
            }
        }
コード例 #7
0
ファイル: Formula.cs プロジェクト: RobertiF/Dynamo
 public Formula(WorkspaceModel workspace)
     : base(workspace)
 {
     ArgumentLacing = LacingStrategy.Shortest;
     OutPortData.Add(new PortData("", "Result of math computation"));
     RegisterAllPorts();
 }
コード例 #8
0
ファイル: Elements.cs プロジェクト: whztt07/Dynamo
 protected ElementsQueryBase(WorkspaceModel workspaceModel) : base(workspaceModel)
 {
     var u = RevitDynamoModel.RevitServicesUpdater;
     u.ElementsAdded += Updater_ElementsAdded;
     u.ElementsModified += Updater_ElementsModified;
     u.ElementsDeleted += Updater_ElementsDeleted;
 }
コード例 #9
0
ファイル: DynamoModel.cs プロジェクト: jbenoit44/Dynamo
 internal void OnWorkspaceSaved(WorkspaceModel model)
 {
     if (WorkspaceSaved != null)
     {
         WorkspaceSaved(model);
     }
 }
コード例 #10
0
        /// <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();
        }
コード例 #11
0
        /// <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();
        }
コード例 #12
0
ファイル: DynamoModelEvents.cs プロジェクト: MrWalsh/Dynamo
        protected virtual void OnWorkspaceAdded(WorkspaceModel obj)
        {
            var handler = WorkspaceAdded;
            if (handler != null) handler(obj);

            WorkspaceEvents.OnWorkspaceAdded(obj.Guid, obj.Name, obj.GetType());
        }
コード例 #13
0
ファイル: DynamoModelEvents.cs プロジェクト: MrWalsh/Dynamo
        public virtual void OnWorkspaceCleared(WorkspaceModel workspace)
        {
            if (WorkspaceCleared != null)
                WorkspaceCleared(workspace);

            WorkspaceEvents.OnWorkspaceCleared();
        }
コード例 #14
0
ファイル: WatchImage.cs プロジェクト: whztt07/Dynamo
        public WatchImageCore(WorkspaceModel ws) : base(ws)
        {
            InPortData.Add(new PortData("image", "image"));
            OutPortData.Add(new PortData("image", "image"));

            RegisterAllPorts();
        }
コード例 #15
0
        protected virtual void OnWorkspaceRemoved(WorkspaceModel obj)
        {
            var handler = WorkspaceRemoved;
            if (handler != null) handler(obj);

            WorkspaceEvents.OnWorkspaceRemoved(obj.Guid, obj.Name);
        }
コード例 #16
0
ファイル: Excel.cs プロジェクト: RobertiF/Dynamo
 public GetWorksheetsFromExcelWorkbook(WorkspaceModel workspace)
     : base(workspace)
 {
     InPortData.Add(new PortData("workbook", "The excel workbook"));
     OutPortData.Add(new PortData("worksheets", "A list of worksheets"));
     RegisterAllPorts();
 }
コード例 #17
0
ファイル: Elements.cs プロジェクト: RobertiF/Dynamo
        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();
        }
コード例 #18
0
ファイル: Excel.cs プロジェクト: RobertiF/Dynamo
 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();
 }
コード例 #19
0
ファイル: File.cs プロジェクト: RobertiF/Dynamo
        protected FileSystemBrowser(WorkspaceModel workspace, string tip)
            : base(workspace)
        {
            OutPortData[0].ToolTipString = tip;
            RegisterAllPorts();

            Value = "";
        }
コード例 #20
0
ファイル: ScopedNodeTest.cs プロジェクト: RobertiF/Dynamo
            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();
            }
コード例 #21
0
ファイル: Apply.cs プロジェクト: RobertiF/Dynamo
        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();
        }
コード例 #22
0
ファイル: MapCombineLacing.cs プロジェクト: RobertiF/Dynamo
        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();
        }
コード例 #23
0
ファイル: ScopedIf.cs プロジェクト: whztt07/Dynamo
        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();
        }
コード例 #24
0
ファイル: AndOr.cs プロジェクト: whztt07/Dynamo
        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();
        }
コード例 #25
0
ファイル: CreateList.cs プロジェクト: whztt07/Dynamo
        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;
        }
コード例 #26
0
ファイル: CodeBlockNode.cs プロジェクト: JeffreyMcGrew/Dynamo
 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();
 }
コード例 #27
0
ファイル: MapCombineLacing.cs プロジェクト: RobertiF/Dynamo
        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();
        }
コード例 #28
0
ファイル: ConnectorModel.cs プロジェクト: whztt07/Dynamo
 /// <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;
 }
コード例 #29
0
ファイル: SunPath.cs プロジェクト: whztt07/Dynamo
        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();
        }
コード例 #30
0
        /// <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());
        }
コード例 #31
0
 /// <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);
 }
コード例 #32
0
 public NoteModel(WorkspaceModel workspace, double x, double y)
 {
     this.workspaceModel = workspace;
     X = x;
     Y = y;
 }
コード例 #33
0
 public WorkspaceEventArgs(WorkspaceModel workspace)
 {
     this.Workspace = workspace;
 }