Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.external.notify passing data other than string

I am trying to write a windows phone app and I want to invoke a delegate when a user wants performs an action. But the problem is the action has to be performed in the webpage and the event has to be handled inside the app. I know this is not a perfect design, but all I am doing is trying to explore ways to modify the data that is being passed from a webbrowser control back to the application.

This is my Question,

        +---------------------------------------------+
        | Inside App (C# Code Behind)                 |
        |         App Data.                           |
        |                                             |
        |   Delegate that handles the event.          |
        |      ^       +----------------------+       |
        |      |       |Webbrowser Control    |       |
        |      +       |                      |       |
        |      |       |                      |       |
        |      +------------+Action Performed |       |
        |              |   (HTML Control)             |
        |              |                      |       |
        |              |                      |       |
        |              +----------------------+       |
        |                                             |
        |                                             |
        +---------------------------------------------+

I am currently using window.external.notify(somestrings) and using reflection to invoke the method in the code behind. Other than passing around a string can I pass a generic Object which when passed to C# code which can later be type cast to a delegate object which can then be invoked?

If not for delegates can I invoke the method that is part of the app in the code behind (C#) by just passing the function's name?

like image 212
Ajai Avatar asked Mar 12 '26 13:03

Ajai


1 Answers

It's only possible to pass a string via the Notify() method.

You could try invoking the method name you are passing via reflection. Alternatively, if you know the methods you may invoke at designtime you could pass a value which you translate in code to the method you're after.

like image 111
Matt Lacey Avatar answered Mar 15 '26 02:03

Matt Lacey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!