Application.Eval callback syntax in C# vs VB

Answered
0
0

I’m using a code-converter to change my WiseJ VB to C#.  Do you know the C# equivalent of this function?

It appears this was documented here, but its 404 now: https://wisej.com/docs/2.0/html/M_Wisej_Web_Application_Eval_1.htm

 

Public Sub DetectIOSWebAppStandalone()
‘does a one-time check of window.navigator.standalone and writes a session flag
‘so we know if we have been launched in iOS webview

Application.Eval(“window.navigator.standalone”, Sub(a As Boolean)
If a = True Then
Application.Session(“isIOSstandalone”) = True ‘its standalone mode
Else
Application.Session(“isIOSstandalone”) = False ‘its not standalone mode
End If
End Sub)
End Sub

 

Am I correct that this is the correct syntax?

Application.Eval(“window.navigator.standalone”, (dynamic a) =>
{
if (a == true)
{
Application.Session.isIOSstandalone = true;
} else
{
Application.Session.isIOSstandalone = false;
}
});

 

thanks

 

  • You must to post comments
Best Answer
0
0

Hi Andrew,

Doc has move there https://docs.wisej.com/docs/controls/general/application#javascript

You function must be like this
Application.Eval(“window.navigator.standalone”, (a) => // Type of 'a' is dynamic
{
if (a == true)
{
Application.Session.isIOSstandalone = true;
} else
{
Application.Session.isIOSstandalone = false;
}
});

Happy codidng,

Kevin (ITG)

  • Andrew Niese
    thanks. is this functionally equivalent as explicitly typing ‘a’ as dynamic, as in my example above?
  • Kevin
    • Kevin
    • Nov 3, 2021 - 8:57 pm
    Yes in c# arrow function (delegate) do not need to specify type juste name of variable.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.