Beispiel #1
0
        private static void RegisterCustomNodeInstanceForUpdates(Function node, CustomNodeWorkspaceModel workspace)
        {
            Action defUpdatedHandler = () =>
            {
                node.ResyncWithDefinition(workspace.CustomNodeDefinition);
            };
            workspace.DefinitionUpdated += defUpdatedHandler;

            Action infoChangedHandler = () =>
            {
                var info = workspace.CustomNodeInfo;
                node.NickName = info.Name;
                node.Description = info.Description;
                node.Category = info.Category;
            };
            workspace.InfoChanged += infoChangedHandler;
            node.Disposed += (args) =>
            {
                workspace.DefinitionUpdated -= defUpdatedHandler;
                workspace.InfoChanged -= infoChangedHandler;
            };
        }
Beispiel #2
0
 private void RegisterCustomNodeInstanceForLateInitialization(Function node, Guid id, string nickname, bool isTestMode)
 {
     var disposed = false;
     Action<CustomNodeInfo> infoUpdatedHandler = null;
     infoUpdatedHandler = newInfo =>
     {
         if (newInfo.FunctionId == id || newInfo.Name == nickname)
         {
             CustomNodeWorkspaceModel foundWorkspace;
             if (TryGetFunctionWorkspace(newInfo.FunctionId, isTestMode, out foundWorkspace))
             {
                 node.ResyncWithDefinition(foundWorkspace.CustomNodeDefinition);
                 RegisterCustomNodeInstanceForUpdates(node, foundWorkspace);
                 InfoUpdated -= infoUpdatedHandler;
                 disposed = true;
             }
         }
     };
     InfoUpdated += infoUpdatedHandler;
     node.Disposed += (args) =>
     {
         if (!disposed)
             InfoUpdated -= infoUpdatedHandler;
     };
 }