Hello,
Welcome to Microsoft Q&A!
There are two main uses about webview.InvokeScriptAsync(), the first is to call a function that already exists in the HTML, and could pass the parameters or with the JavaScript eval function to inject content into the web page. If you want to achieve the function about the sofisticated code like the one above that you used in your old VB projects, you need to convert the code snippet from VB to the JavaScript and then put the JavaScript statements into webview.InvokeScriptAsync() method.
About how to interact with the content of the WebView by using the InvokeScriptAsync method, you can refer to this document which contains some code samples.