开发者

Help with silverlight

开发者 https://www.devze.com 2023-03-06 14:49 出处:网络
I have some methods which are not compiled with Silverlight framework but are very essential for execution of SL workflow(by workflow, I mean to process my application completely). What is the best/qu

I have some methods which are not compiled with Silverlight framework but are very essential for execution of SL workflow(by workflow, I mean to process my application completely). What is the best/quickest way to do so? I was thinking of publishing a web-service(for non-sl compiled methods) and make SL call into my 开发者_如何学GoWS.. but I am unable to see/create webservice instance even after registering one in my SL project. (I am using VS 2010) any help?


Esentially, you have three ways to run code.

  • native built-in methods in your application--this would be the easiest way
  • methods that live in an external silverlight assembly, like a class library
  • use a webservice
  • if you use a webservice, you have to either host the website yourself or use a 3rd party website, then add a reference to said service. if the service is not hosted on the same website as your silverlight app, there must be a cross-domain policy file in place otherwise silverlight will not use the service.

    if you use an external assembly, it MUST be a silverlight assembly. you can not use a windows class library, etc.


    There is a common (and relatively easy) way to solve this issue without requiring a web service: you can create a new Silverlight class library and then share the files from the other project through to your new Silverlight library.

    To do this, right click on the library in the Solution Explorer, and select Add -> Existing Item, then navigate to the appropriate code file, select it, but instead of just clicking Add you should instead click the little down arrow and select Add As Link.

    Of course when you do this you have to ensure that the shared files don't contain anything that cannot be compiled targeting the Silverlight runtime, if they do then you will either have to use conditional compilation directives to isolate out that code, or revert to the web service option.

    0

    精彩评论

    暂无评论...
    验证码 换一张
    取 消

    关注公众号