Refresh Custom C# Node Output

We have created a custom node in C#, this node has a button that opens a URL in an instance of CEFSharp web-kit , and gets the cookies that get generated by the URL.
The issue we are facing is that the output gets recalculated (refreshed) only after disconnecting and reconnecting the Input to this custom node.

Does anyone know how can we recalculate Output upon closure of the CEFSharp ?

Here is the code of the main class:

namespace WebExample.WebExample
{
[NodeName(“Get Cookies From Web”)]
[NodeDescription(“Get Cookies From Web Browser”)]

[InPortNames(“Input”)]
[InPortTypes(“string”)]
[OutPortNames(“Output”)]
[OutPortTypes(“List”)]
[IsDesignScriptCompatible]
public class GetData:NodeModel
{
public static List list = new List();
public GetData()
{
RegisterAllPorts();
}

public override IEnumerable<AssociativeNode> BuildOutputAst(List<AssociativeNode> inputAstNodes)
{
   
        var sliderValue = AstFactory.BuildExprList(GetData.list);
    var functionCall =
      AstFactory.BuildFunctionCall(
         new Func< string,List<string>>(GetCookie.Class1.getcookies), new List<AssociativeNode> { inputAstNodes[0] });




    return new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), functionCall) };
}

}
}

Subscribe to the WindowClosing event.

1 Like

Well, it would be great if that fixes the issue, but what happens is that we can’t manage to trigger the function that generates the output inside the Dynamo while/after closing the browser.
Nevertheless, if we wait for 30 seconds or move the node from its position in the Dynamo workspace, it gets updated automatically.

thanks Konrad

Ok, my suggestion to subscribe to the WindowClosing even has nothing to do with how Dynamo works. It was a general suggestion, that if you want to perform some action when a window closes, you are best bet is to subscribe to the Window’s “Closing” event. What you do inside of that event’s handler is up to you. In this case you want to trigger NodeView recalculation. If I remember correctly you can call OnNodeModified(true) to do that.

1 Like