none
pass managed byte[] or Stream via JavaScript between WPF and SL

    Question

  • I have a WPF 4.0 application that includes a WebBrowser control used to display a HTML page which includes a SL 4.0 app.

    I have managed to make both the WPF and the SL app call methods of the other via a JavaScript layer in between. This works fine as long as I am only using value types like int or string as argument types for these methods, like this:

     

     
            [ScriptableMember()]
            public void SetTextFromJavaScript(string text)
            {
                textBox.Text = text;
            }
     
     

    There are two things I haven't figured out, yet - if someone has, sample code is much appreciated:

    1. (How) can you pass a Stream between SL and WPF?
    2. (How) can you pass a byte array between SL and WPF?
    Friday, April 23, 2010 6:28 AM

Answers

    1. You can't, a stream is a complex object not a data type
    2. You can use a base 64 encoding to convert the byte array to a string and back again.

     

    Monday, April 26, 2010 6:43 AM