To invoke JavaScript function from C#
object result = mWebBrowser.Document.InvokeScript("FunctionName", new String[] { Parameter1 });
// If the function succeed (my function return a boolean)
if (null == result || result.ToString().ToLower() == "false")
{
// Code
}
Is this what you want? Like this your c# code call your javascript, and it returns a value
My WPF Xaml:
<UserControl x:Class="MediaViewer.WebViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">
<WindowsFormsHost>
<wf:WebBrowser x:Name="mWebBrowser" />
</WindowsFormsHost>
</UserControl>